Skip to content

Commit

Permalink
lint: Calculate strip_rule outside the loop.
Browse files Browse the repository at this point in the history
This adds up over a million lines. :)
  • Loading branch information
Steve Howell committed Nov 10, 2018
1 parent dfa33e0 commit 9d1fcba
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tools/linter_lib/custom_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,15 @@ def custom_check_file(fn: str,
}

pattern = re.compile(rule['pattern'])
strip_rule = rule.get('strip')
for (i, line, line_newline_stripped, line_fully_stripped) in line_tups:
if line_fully_stripped in exclude_lines:
exclude_lines.remove(line_fully_stripped)
continue
try:
line_to_check = line_fully_stripped
if rule.get('strip') is not None:
if rule['strip'] == '\n':
if strip_rule is not None:
if strip_rule == '\n':
line_to_check = line_newline_stripped
else:
raise Exception("Invalid strip rule")
Expand Down

0 comments on commit 9d1fcba

Please sign in to comment.