summaryrefslogtreecommitdiff
path: root/check_checkers.py
diff options
context:
space:
mode:
Diffstat (limited to 'check_checkers.py')
-rwxr-xr-xcheck_checkers.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/check_checkers.py b/check_checkers.py
index aee3f49..413b79d 100755
--- a/check_checkers.py
+++ b/check_checkers.py
@@ -23,7 +23,7 @@ Error = Tuple[str, int, str]
class Checker:
name: str
url: str
- extra_flags: Tuple[str, ...] = ()
+ extra_args: Tuple[str, ...] = ()
def run(self, path: str, typeshed_path: str) -> List[Error]:
"""
@@ -56,7 +56,7 @@ class Mypy(Checker):
# fmt: off
'--cache-dir', cachedir,
'--custom-typeshed-dir', typeshed_path,
- *cls.extra_flags,
+ *cls.extra_args,
# fmt: on
'--',
path,
@@ -74,7 +74,7 @@ class Mypy(Checker):
class MypyStrict(Mypy):
- extra_flags = ('--strict',)
+ extra_args = ('--strict',)
class Pytype(Checker):
@@ -92,7 +92,7 @@ class Pytype(Checker):
def run(cls, path: str, typeshed_path: str):
env = {'TYPESHED_HOME': typeshed_path, 'PATH': os.environ['PATH']}
proc = Popen(
- ['pytype', '--', path],
+ ['pytype', *cls.extra_args, '--', path],
stdout=PIPE,
stderr=PIPE,
encoding='utf-8',
@@ -113,14 +113,15 @@ class Pyright(Checker):
name = 'Pyright'
url = 'https://github.com/microsoft/pyright'
- @staticmethod
- def run(path: str, typeshed_path: str):
+ @classmethod
+ def run(cls, path: str, typeshed_path: str):
proc = Popen(
[
'pyright',
# fmt: off
'--typeshed-path', typeshed_path,
'--outputjson',
+ *cls.extra_args,
# fmt: on
# pyright does not support --
path,
@@ -190,11 +191,11 @@ def run(
out.write('<a href="{}">'.format(html.escape(checker.url)))
out.write(checker.name)
out.write('</a>')
- if checker.extra_flags:
+ if checker.extra_args:
out.write(' with ')
out.write(
', '.join(
- f'<code>{html.escape(flag)}</code>' for flag in checker.extra_flags
+ f'<code>{html.escape(flag)}</code>' for flag in checker.extra_args
)
)
out.write('<br>({})'.format(html.escape(checker.version())))