From fe40934a1c98150ee6684a7cdd21bac640fd2ac8 Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Fri, 25 Feb 2022 07:14:34 +0100 Subject: add missing type param puzzle & test pyright strict --- check_checkers.py | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) (limited to 'check_checkers.py') diff --git a/check_checkers.py b/check_checkers.py index 413b79d..851c66f 100755 --- a/check_checkers.py +++ b/check_checkers.py @@ -143,6 +143,10 @@ class Pyright(Checker): ) +class PyrightStrict(Pyright): + extra_args = ('-p', 'pyrightstrict.json') + + # We don't check pyre because it has a very slow startup time (5s) since it parses the whole typeshed. # (see https://github.com/facebook/pyre-check/issues/592) @@ -193,11 +197,16 @@ def run( out.write('') if checker.extra_args: out.write(' with ') - out.write( - ', '.join( - f'{html.escape(flag)}' for flag in checker.extra_args - ) - ) + out.write('') + for arg in checker.extra_args: + if not arg.startswith('-'): + out.write(''.format(html.escape(arg))) + out.write(html.escape(arg) + ' ') + if not arg.startswith('-'): + out.write('') + os.makedirs('dist/configs', exist_ok=True) + shutil.copyfile(arg, 'dist/configs/' + arg) + out.write('') out.write('
({})'.format(html.escape(checker.version()))) out.write('') @@ -222,15 +231,18 @@ def run( no_error_ok = '# error' not in code results = [ - (checker.__class__.__name__, checker_results[checker.__class__.__name__]) + (checker, checker_results[checker.__class__.__name__]) for checker in checkers ] while results: - class_name, errors = results.pop(0) + checker, errors = results.pop(0) expected = (errors and error_ok) or (not errors and no_error_ok) colspan = 1 - if errors and results and results[0][1] == errors: + if results and (checker.name, errors) == ( + results[0][0].name, + results[0][1], + ): results.pop(0) colspan = 2 out.write( @@ -249,8 +261,10 @@ def run( out.write('
no errors found') if not expected: checker_issues = issues.get( - class_name.lower(), - issues.get(class_name.lower().replace('strict', ''), {}), + 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( @@ -279,7 +293,7 @@ if __name__ == '__main__': with open('dist/checkers.html', 'w') as f: run( - [Mypy(), MypyStrict(), Pytype(), Pyright()], + [Mypy(), MypyStrict(), Pytype(), Pyright(), PyrightStrict()], ['puzzles/' + f for f in sorted(os.listdir('puzzles'))], typeshed, f, -- cgit v1.2.3