From 7a48750610bbed164750a3f0fbf0fd9e88fa56c5 Mon Sep 17 00:00:00 2001 From: w0rp Date: Sun, 10 Feb 2019 11:43:48 +0000 Subject: Complain about binary operators on the ends of lines --- test/script/block-padding-checker | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'test/script/block-padding-checker') diff --git a/test/script/block-padding-checker b/test/script/block-padding-checker index 97ae7646..2feab6d0 100755 --- a/test/script/block-padding-checker +++ b/test/script/block-padding-checker @@ -11,6 +11,7 @@ import re INDENTATION_RE = re.compile(r'^ *') COMMENT_LINE_RE = re.compile(r'^ *"') COMMAND_RE = re.compile(r'^ *([a-zA-Z\\]+)') +OPERATOR_END_RE = re.compile(r'(&&|\|\||\+|-|\*\| /)$') START_BLOCKS = set(['if', 'for', 'while', 'try', 'function']) END_BLOCKS = set(['endif', 'endfor', 'endwhile', 'endtry', 'endfunction']) @@ -70,7 +71,7 @@ def check_lines(line_iter): if ( previous_indentation_level is not None and indentation_level != previous_indentation_level - and abs(indentation_level - previous_indentation_level) != 4 + and abs(indentation_level - previous_indentation_level) != 4 # noqa ): yield ( line_number, @@ -119,6 +120,12 @@ def check_lines(line_iter): previous_line_blank = False previous_indentation_level = indentation_level + if OPERATOR_END_RE.search(line): + yield ( + line_number, + 'Put operators at the start of lines instead' + ) + def main(): status = 0 -- cgit v1.2.3