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

View File

@@ -74,15 +74,7 @@ def get_line_info_from_file(fn: str) -> List[LineTup]:
line_tups.append(tup) line_tups.append(tup)
return line_tups return line_tups
def custom_check_file(fn: str, def get_rules_applying_to_fn(fn: str, rules: RuleList) -> RuleList:
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 = [] rules_to_apply = []
for rule in rules: for rule in rules:
excluded = False excluded = False
@@ -101,6 +93,19 @@ def custom_check_file(fn: str,
continue continue
rules_to_apply.append(rule) 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: for rule in rules_to_apply:
exclude_lines = { exclude_lines = {
line for line for