mirror of
https://github.com/neovim/neovim.git
synced 2025-10-26 12:27:24 +00:00
clint: Check for spaces after { and before }
This commit is contained in:
10
clint.py
10
clint.py
@@ -1994,7 +1994,8 @@ def CheckSpacing(filename, clean_lines, linenum, nesting_state, error):
|
|||||||
if/for/while/switch, no spaces around parens in function calls, two
|
if/for/while/switch, no spaces around parens in function calls, two
|
||||||
spaces between code and comment, don't start a block with a blank
|
spaces between code and comment, don't start a block with a blank
|
||||||
line, don't end a function with a blank line, don't add a blank line
|
line, don't end a function with a blank line, don't add a blank line
|
||||||
after public/protected/private, don't have too many blank lines in a row.
|
after public/protected/private, don't have too many blank lines in a row,
|
||||||
|
spaces after {, spaces before }.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
filename: The name of the current file.
|
filename: The name of the current file.
|
||||||
@@ -2323,6 +2324,13 @@ def CheckSpacing(filename, clean_lines, linenum, nesting_state, error):
|
|||||||
'Extra space before last semicolon. If this should be an empty '
|
'Extra space before last semicolon. If this should be an empty '
|
||||||
'statement, use {} instead.')
|
'statement, use {} instead.')
|
||||||
|
|
||||||
|
if Search(r'\{(?!\})\S', line):
|
||||||
|
error(filename, linenum, 'whitespace/braces', 5,
|
||||||
|
'Missing space after {')
|
||||||
|
if Search(r'\S(?<!\{)\}', line):
|
||||||
|
error(filename, linenum, 'whitespace/braces', 5,
|
||||||
|
'Missing space before }')
|
||||||
|
|
||||||
|
|
||||||
def GetPreviousNonBlankLine(clean_lines, linenum):
|
def GetPreviousNonBlankLine(clean_lines, linenum):
|
||||||
"""Return the most recent non-blank line and its line number.
|
"""Return the most recent non-blank line and its line number.
|
||||||
|
|||||||
Reference in New Issue
Block a user