diff options
-rwxr-xr-x | check_checkers.py | 36 | ||||
-rw-r--r-- | puzzles/03_missing_type_param.py | 1 | ||||
-rw-r--r-- | puzzles/04_type_error_in_untyped_def.py (renamed from puzzles/03_type_error_in_untyped_def.py) | 0 | ||||
-rw-r--r-- | pyrightstrict.json | 3 |
4 files changed, 29 insertions, 11 deletions
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('</a>') if checker.extra_args: out.write(' with ') - out.write( - ', '.join( - f'<code>{html.escape(flag)}</code>' for flag in checker.extra_args - ) - ) + out.write('<code>') + for arg in checker.extra_args: + if not arg.startswith('-'): + out.write('<a href="configs/{}">'.format(html.escape(arg))) + out.write(html.escape(arg) + ' ') + if not arg.startswith('-'): + out.write('</a>') + os.makedirs('dist/configs', exist_ok=True) + shutil.copyfile(arg, 'dist/configs/' + arg) + out.write('</code>') out.write('<br>({})'.format(html.escape(checker.version()))) out.write('</tr>') @@ -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('<center>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, diff --git a/puzzles/03_missing_type_param.py b/puzzles/03_missing_type_param.py new file mode 100644 index 0000000..a2bcf80 --- /dev/null +++ b/puzzles/03_missing_type_param.py @@ -0,0 +1 @@ +x: list = [] # maybe error diff --git a/puzzles/03_type_error_in_untyped_def.py b/puzzles/04_type_error_in_untyped_def.py index 6c87c71..6c87c71 100644 --- a/puzzles/03_type_error_in_untyped_def.py +++ b/puzzles/04_type_error_in_untyped_def.py diff --git a/pyrightstrict.json b/pyrightstrict.json new file mode 100644 index 0000000..ca8bcb9 --- /dev/null +++ b/pyrightstrict.json @@ -0,0 +1,3 @@ +{ + "typeCheckingMode": "strict" +} |