aboutsummaryrefslogtreecommitdiff
path: root/clint.py
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2015-12-08 14:13:43 +0300
committerZyX <kp-pav@yandex.ru>2015-12-09 19:55:34 +0300
commit74c960007fb06a4a37fd2cd457f1ef40d86ec55b (patch)
treec9c4b12747e8892f5f76752080d474c3eeff8df6 /clint.py
parent4c0ac1ca26247b35109f399e4ac5f0632df65e10 (diff)
downloadrneovim-74c960007fb06a4a37fd2cd457f1ef40d86ec55b.tar.gz
rneovim-74c960007fb06a4a37fd2cd457f1ef40d86ec55b.tar.bz2
rneovim-74c960007fb06a4a37fd2cd457f1ef40d86ec55b.zip
clint: Check for spaces after { and before }
Diffstat (limited to 'clint.py')
-rwxr-xr-xclint.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/clint.py b/clint.py
index 9506a7fa3f..35d687d137 100755
--- a/clint.py
+++ b/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
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
- 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:
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 '
'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):
"""Return the most recent non-blank line and its line number.