summaryrefslogtreecommitdiff
path: root/check_checkers.py
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2022-02-25 07:14:34 +0100
committerMartin Fischer <martin@push-f.com>2022-02-25 07:14:47 +0100
commitfe40934a1c98150ee6684a7cdd21bac640fd2ac8 (patch)
tree9eaaa41acd07c1106cae0ac353b687545bd9af73 /check_checkers.py
parentef72153e72e7e8a27d01737d245b362ef843f12e (diff)
add missing type param puzzle & test pyright strict
Diffstat (limited to 'check_checkers.py')
-rwxr-xr-xcheck_checkers.py36
1 files changed, 25 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,