diff options
author | Martin Fischer <martin@push-f.com> | 2022-02-24 12:04:32 +0100 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2022-02-24 12:04:44 +0100 |
commit | ef72153e72e7e8a27d01737d245b362ef843f12e (patch) | |
tree | 8e706daf0f80f1833d5e1286ab559900e0233979 /check_checkers.py | |
parent | 743b5b586b8910b4d8536a8e1b4ff9b74e346f6c (diff) |
rename Checker.extra_flags to extra_args
Diffstat (limited to 'check_checkers.py')
-rwxr-xr-x | check_checkers.py | 17 |
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()))) |