Skip to content

Commit 6cecf3a

Browse files
committed
Properly classify recursion error on Python <=3.4
1 parent 4ddbb8f commit 6cecf3a

3 files changed

Lines changed: 16 additions & 6 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Markdownlint configuration for corpus test reports
2+
# Disable line length rule since tables naturally exceed 80 characters
3+
MD013: false

.github/workflows/test_corpus.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,4 +144,11 @@ jobs:
144144
volumes: |
145145
/corpus-results:/corpus-results
146146
run: |
147-
python3.13 workflow/corpus_test/generate_report.py /corpus-results ${{ inputs.ref }} ${{ steps.ref.outputs.commit }} ${{ inputs.base-ref }} ${{ steps.base-ref.outputs.commit }} >> $GITHUB_STEP_SUMMARY
147+
python3.13 workflow/corpus_test/generate_report.py /corpus-results ${{ inputs.ref }} ${{ steps.ref.outputs.commit }} ${{ inputs.base-ref }} ${{ steps.base-ref.outputs.commit }} | tee -a $GITHUB_STEP_SUMMARY > report.md
148+
149+
- name: Lint Report
150+
uses: DavidAnson/markdownlint-cli2-action@05f32210e84442804257b2a6f20b273450ec8265 # v19
151+
continue-on-error: true
152+
with:
153+
config: '.config/corpus_report.markdownlint.yaml'
154+
globs: 'report.md'

corpus_test/generate_report.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def add(self, result: Result):
7676
self.recursion_error_count += 1
7777
elif result.outcome == 'UnstableMinification':
7878
self.unstable_minification_count += 1
79-
elif result.outcome.startswith('Exception') is not is_syntax_error(self.python_version, result):
79+
elif result.outcome.startswith('Exception') and not is_syntax_error(self.python_version, result):
8080
self.exception_count += 1
8181

8282
@property
@@ -101,13 +101,13 @@ def larger_than_original(self) -> Iterable[Result]:
101101
def recursion_error(self) -> Iterable[Result]:
102102
"""Return those entries that have a recursion error"""
103103
for result in self.entries.values():
104-
if result.outcome == 'RecursionError':
104+
if is_recursion_error(self.python_version, result):
105105
yield result
106106

107107
def exception(self) -> Iterable[Result]:
108108
"""Return those entries that have an exception"""
109109
for result in self.entries.values():
110-
if result.outcome.startswith('Exception'):
110+
if result.outcome.startswith('Exception') and not is_syntax_error(self.python_version, result) and not is_recursion_error(self.python_version, result):
111111
yield result
112112

113113
def unstable_minification(self) -> Iterable[Result]:
@@ -271,7 +271,7 @@ def report_exceptions(results_dir: str, python_versions: list[str], minifier_sha
271271
yield f'| {entry.corpus_entry} | {python_version} | {entry.outcome} |'
272272

273273
if not exceptions_found:
274-
yield ' None | | |'
274+
yield '| None | | |'
275275

276276

277277
def report_larger_than_base(results_dir: str, python_versions: list[str], minifier_sha: str, base_sha: str) -> str:
@@ -387,7 +387,7 @@ def report(results_dir: str, minifier_ref: str, minifier_sha: str, base_ref: str
387387
f'| {format_difference(summary.larger_than_original(), base_summary.larger_than_original())} ' +
388388
f'| {format_difference(summary.recursion_error(), base_summary.recursion_error())} ' +
389389
f'| {format_difference(summary.unstable_minification(), base_summary.unstable_minification())} ' +
390-
f'| {format_difference(summary.exception(), base_summary.exception())} '
390+
f'| {format_difference(summary.exception(), base_summary.exception())} |'
391391
)
392392

393393
if ENHANCED_REPORT:

0 commit comments

Comments
 (0)