diff options
Diffstat (limited to 'check_checkers.py')
-rwxr-xr-x | check_checkers.py | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/check_checkers.py b/check_checkers.py index 90ccc43..e8b1b2f 100755 --- a/check_checkers.py +++ b/check_checkers.py @@ -21,7 +21,9 @@ Error = Tuple[str, int, str] class Checker: + name: str url: str + extra_flags: Tuple[str, ...] = () def run(self, path: str, typeshed_path: str) -> List[Error]: """ @@ -35,6 +37,7 @@ class Checker: class Mypy(Checker): + name = 'Mypy' url = 'https://github.com/python/mypy' # mypy cannot output JSON (https://github.com/python/mypy/issues/10816) @@ -53,6 +56,7 @@ class Mypy(Checker): # fmt: off '--cache-dir', cachedir, '--custom-typeshed-dir', typeshed_path, + *cls.extra_flags, # fmt: on '--', path, @@ -69,7 +73,12 @@ class Mypy(Checker): return mypy.api.run(['--version'])[0].split()[1].strip() +class MypyStrict(Mypy): + extra_flags = ('--strict',) + + class Pytype(Checker): + name = 'Pytype' url = 'https://github.com/google/pytype' # pytype supports CSV output only for pytype-single which however doesn't support multiple modules @@ -101,6 +110,7 @@ class Pytype(Checker): class Pyright(Checker): + name = 'Pyright' url = 'https://github.com/microsoft/pyright' @staticmethod @@ -178,8 +188,11 @@ def run( for checker in checkers: out.write('<th>') out.write('<a href="{}">'.format(html.escape(checker.url))) - out.write(checker.__class__.__name__) + out.write(checker.name) out.write('</a>') + if checker.extra_flags: + out.write(' with ') + out.write(', '.join(f'<code>{html.escape(flag)}</code>' for flag in checker.extra_flags)) out.write('<br>({})'.format(html.escape(checker.version()))) out.write('</tr>') @@ -217,7 +230,12 @@ def run( else: out.write('<center>no errors found') if not expected: - checker_issues = issues.get(checker.__class__.__name__.lower(), {}) + checker_issues = issues.get( + checker.__class__.__name__.lower(), + issues.get( + checker.__class__.__name__.lower().replace('strict', ''), {} + ), + ) issue = checker_issues.get( os.path.splitext(os.path.basename(puzzle))[0].split( '_', maxsplit=1 @@ -245,7 +263,7 @@ if __name__ == '__main__': with open('dist/checkers.html', 'w') as f: run( - [Mypy(), Pytype(), Pyright()], + [Mypy(), MypyStrict(), Pytype(), Pyright()], ['puzzles/' + f for f in sorted(os.listdir('puzzles'))], typeshed, f, |