aboutsummaryrefslogtreecommitdiff
path: root/src/clint.py
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2017-06-03 21:00:05 +0200
committerGitHub <noreply@github.com>2017-06-03 21:00:05 +0200
commit1b2acb8d958c1c8e2f382c2de9c98586801fd9fe (patch)
tree32cfd15ba90209b6ef34ef2f2d3630a9400105c8 /src/clint.py
parentfd07250e6ca10929d5523db811b2c3a83c61a012 (diff)
parent3f553ac0b9b3866f1254e669eb0c1c019c789a60 (diff)
downloadrneovim-1b2acb8d958c1c8e2f382c2de9c98586801fd9fe.tar.gz
rneovim-1b2acb8d958c1c8e2f382c2de9c98586801fd9fe.tar.bz2
rneovim-1b2acb8d958c1c8e2f382c2de9c98586801fd9fe.zip
Merge pull request #6807 from bfredl/attrindent
[RFC] lint: check indentation of FUNC_ATTR lines
Diffstat (limited to 'src/clint.py')
-rwxr-xr-xsrc/clint.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/clint.py b/src/clint.py
index 3babb7772b..e6bedd37dc 100755
--- a/src/clint.py
+++ b/src/clint.py
@@ -2600,16 +2600,23 @@ def CheckBraces(filename, clean_lines, linenum, error):
else:
func_start_linenum = end_linenum + 1
while not clean_lines.lines[func_start_linenum] == '{':
- if not Match(r'^(?:\s*\b(?:FUNC_ATTR|REAL_FATTR)_\w+\b(?:\(\d+(, \d+)*\))?)+$',
- clean_lines.lines[func_start_linenum]):
+ attrline = Match(r'^((?!# *define).*?)(?:FUNC_ATTR|FUNC_API|REAL_FATTR)_\w+(?:\(\d+(, \d+)*\))?',
+ clean_lines.lines[func_start_linenum])
+ if attrline:
+ if len(attrline.group(1)) != 2:
+ error(filename, func_start_linenum,
+ 'whitespace/indent', 5,
+ 'Function attribute line should have 2-space '
+ 'indent')
+
+ func_start_linenum += 1
+ else:
if clean_lines.lines[func_start_linenum].endswith('{'):
error(filename, func_start_linenum,
'readability/braces', 5,
'Brace starting function body must be placed '
'after the function signature')
break
- else:
- func_start_linenum += 1
# An else clause should be on the same line as the preceding closing brace.
# If there is no preceding closing brace, there should be one.