lint: Extract get_rules_applying_to_fn().

This commit is contained in:
Steve Howell 2018-11-10 19:04:07 +00:00 committed by Tim Abbott
parent eda138343b
commit 08e44aac0d
1 changed files with 14 additions and 9 deletions

View File

@ -74,15 +74,7 @@ def get_line_info_from_file(fn: str) -> List[LineTup]:
line_tups.append(tup)
return line_tups
def custom_check_file(fn: str,
identifier: str,
rules: RuleList,
color: Optional[Iterable[str]],
max_length: Optional[int]=None) -> bool:
failed = False
line_tups = get_line_info_from_file(fn=fn)
def get_rules_applying_to_fn(fn: str, rules: RuleList) -> RuleList:
rules_to_apply = []
for rule in rules:
excluded = False
@ -101,6 +93,19 @@ def custom_check_file(fn: str,
continue
rules_to_apply.append(rule)
return rules_to_apply
def custom_check_file(fn: str,
identifier: str,
rules: RuleList,
color: Optional[Iterable[str]],
max_length: Optional[int]=None) -> bool:
failed = False
line_tups = get_line_info_from_file(fn=fn)
rules_to_apply = get_rules_applying_to_fn(fn=fn, rules=rules)
for rule in rules_to_apply:
exclude_lines = {
line for