lint: Run mypy as part of main linter.

To support this, we add a pass_targets option to the main linter
library, because with current mypy, it's generally counterproductive
to pass the list of files in (can produce spurious errors; isn't
faster).
This commit is contained in:
Tim Abbott
2018-12-16 20:58:06 -08:00
parent 3003517430
commit 6b69cc0b39
5 changed files with 16 additions and 11 deletions

View File

@@ -57,8 +57,8 @@ class LinterConfig:
self.lint_functions[func.__name__] = func
return func
def external_linter(self, name, command, target_langs=[]):
# type: (str, List[str], List[str]) -> None
def external_linter(self, name, command, target_langs=[], pass_targets=True):
# type: (str, List[str], List[str], bool) -> None
"""Registers an external linter program to be run as part of the
linter. This program will be passed the subset of files being
linted that have extensions in target_langs. If there are no
@@ -80,7 +80,11 @@ class LinterConfig:
# invoking the external linter.
return 0
p = subprocess.Popen(command + targets,
if pass_targets:
full_command = command + targets
else:
full_command = command
p = subprocess.Popen(full_command,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)