summaryrefslogtreecommitdiff
path: root/check_checkers.py
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2022-02-24 08:46:14 +0100
committerMartin Fischer <martin@push-f.com>2022-02-24 08:46:23 +0100
commit92ad22ca77833d5c5c8841ece9368a6843e20c8d (patch)
tree2b12f3e97984452bdc2178c1939908cdc5155878 /check_checkers.py
parent80aec5a0e58ff0c04423fedb244a35717f680821 (diff)
checkers: merge table cells if mypy & mypy --strict give same result
Diffstat (limited to 'check_checkers.py')
-rwxr-xr-xcheck_checkers.py31
1 files changed, 23 insertions, 8 deletions
diff --git a/check_checkers.py b/check_checkers.py
index e8b1b2f..aee3f49 100755
--- a/check_checkers.py
+++ b/check_checkers.py
@@ -192,7 +192,11 @@ def run(
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(
+ ', '.join(
+ f'<code>{html.escape(flag)}</code>' for flag in checker.extra_flags
+ )
+ )
out.write('<br>({})'.format(html.escape(checker.version())))
out.write('</tr>')
@@ -216,10 +220,23 @@ def run(
error_ok = '# error' in code or '# maybe error' in code
no_error_ok = '# error' not in code
- for checker in checkers:
- errors = checker_results[checker.__class__.__name__]
+ results = [
+ (checker.__class__.__name__, checker_results[checker.__class__.__name__])
+ for checker in checkers
+ ]
+
+ while results:
+ class_name, errors = results.pop(0)
expected = (errors and error_ok) or (not errors and no_error_ok)
- out.write('<td class="{}">'.format('ok' if expected else 'unexpected'))
+ colspan = 1
+ if errors and results and results[0][1] == errors:
+ results.pop(0)
+ colspan = 2
+ out.write(
+ '<td class="{}" colspan={}>'.format(
+ 'ok' if expected else 'unexpected', colspan
+ )
+ )
if errors:
out.write('<ul>')
for filename, line, message in errors:
@@ -231,10 +248,8 @@ def run(
out.write('<center>no errors found')
if not expected:
checker_issues = issues.get(
- checker.__class__.__name__.lower(),
- issues.get(
- checker.__class__.__name__.lower().replace('strict', ''), {}
- ),
+ class_name.lower(),
+ issues.get(class_name.lower().replace('strict', ''), {}),
)
issue = checker_issues.get(
os.path.splitext(os.path.basename(puzzle))[0].split(