diff options
author | w0rp <devw0rp@gmail.com> | 2019-02-10 11:43:48 +0000 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2019-02-10 11:43:48 +0000 |
commit | 7a48750610bbed164750a3f0fbf0fd9e88fa56c5 (patch) | |
tree | f8904b5d9ed2b9b02059cdf267cee46479849c74 /test/script | |
parent | d072d2654c68d1c0bf4a1cb8c15c31e989652669 (diff) | |
download | ale-7a48750610bbed164750a3f0fbf0fd9e88fa56c5.zip |
Complain about binary operators on the ends of lines
Diffstat (limited to 'test/script')
-rwxr-xr-x | test/script/block-padding-checker | 9 |
1 files changed, 8 insertions, 1 deletions
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 |