linter: Move custom_check_file to global namespace.

This is needed in order to mock the method when testing
`custom_check.py`. The diff for this commit is a bit broken;
all it really does is moving the method out of `build_custom_checkers`.
This commit is contained in:
Robert Hönig 2017-09-11 19:56:19 +02:00 committed by Tim Abbott
parent 7a2234dfa2
commit b5cf31efdc
1 changed files with 86 additions and 86 deletions

View File

@ -14,10 +14,7 @@ from typing import cast, Any, Callable, Dict, List, Optional, Tuple
RuleList = List[Dict[str, Any]] # mypy currently requires Aliases at global scope
# https://github.com/python/mypy/issues/3145
def build_custom_checkers(by_lang):
# type: (Dict[str, List[str]]) -> Tuple[Callable[[], bool], Callable[[], bool]]
def custom_check_file(fn, identifier, rules, color, skip_rules=None, max_length=None):
def custom_check_file(fn, identifier, rules, color, skip_rules=None, max_length=None):
# type: (str, str, RuleList, str, Optional[Any], Optional[int]) -> bool
failed = False
@ -103,6 +100,9 @@ def build_custom_checkers(by_lang):
return failed
def build_custom_checkers(by_lang):
# type: (Dict[str, List[str]]) -> Tuple[Callable[[], bool], Callable[[], bool]]
# By default, a rule applies to all files within the extension for which it is specified (e.g. all .py files)
# There are three operators we can use to manually include or exclude files from linting for a rule:
# 'exclude': 'set([<path>, ...])' - if <path> is a filename, excludes that file.