Skip to content

test(linter/plugins): conformance tester avoid repeated loops creating report#16739

Merged
graphite-app[bot] merged 1 commit intomainfrom
12-11-test_linter_plugins_conformance_tester_avoid_repeated_loops_creating_report
Dec 11, 2025
Merged

test(linter/plugins): conformance tester avoid repeated loops creating report#16739
graphite-app[bot] merged 1 commit intomainfrom
12-11-test_linter_plugins_conformance_tester_avoid_repeated_loops_creating_report

Conversation

@overlookmotel
Copy link
Copy Markdown
Member

@overlookmotel overlookmotel commented Dec 11, 2025

Pure refactor to conformance tester. The code written by Claude looped over the same arrays 10+ times, and was hard to read. Instead, categorize rule results once at the start of preparing the report. Ditto for summary stats output to stdout.

@github-actions github-actions bot added A-linter Area - Linter A-cli Area - CLI A-linter-plugins Area - Linter JS plugins C-test Category - Testing. Code is missing test cases, or a PR is adding them labels Dec 11, 2025
Copy link
Copy Markdown
Member Author

overlookmotel commented Dec 11, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the conformance tester to improve performance and readability by categorizing rule results once upfront rather than repeatedly looping through the same arrays 10+ times. The changes eliminate redundant array filtering operations when generating the markdown report and calculating summary statistics.

Key changes:

  • Introduced single-pass categorization of rules into loadErrorRules, noTestRules, passingRules, and failingRules arrays
  • Replaced multiple filter() and reduce() operations with direct array length access
  • Extracted repeated percentage formatting logic into a formatProportion() helper function

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
apps/oxlint/conformance/src/report.ts Refactored to categorize rules once at the start of generateReport(), replacing 10+ filter operations; added formatProportion() helper
apps/oxlint/conformance/src/run.ts Changed from filter().length to reduce() for counting passed tests in console output
apps/oxlint/conformance/src/main.ts Replaced filter operations with a single loop to count load errors and fully passing rules

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Dec 11, 2025
@graphite-app graphite-app bot changed the base branch from 12-11-test_linter_plugins_fix_garbled_output_from_assertions to graphite-base/16739 December 11, 2025 11:17
@graphite-app graphite-app bot force-pushed the graphite-base/16739 branch from 69f77ec to 4416b34 Compare December 11, 2025 11:24
@graphite-app graphite-app bot force-pushed the 12-11-test_linter_plugins_conformance_tester_avoid_repeated_loops_creating_report branch from 90b1406 to ee0f103 Compare December 11, 2025 11:24
@graphite-app graphite-app bot changed the base branch from graphite-base/16739 to main December 11, 2025 11:24
@graphite-app graphite-app bot force-pushed the 12-11-test_linter_plugins_conformance_tester_avoid_repeated_loops_creating_report branch from ee0f103 to 6c6af18 Compare December 11, 2025 11:25
@graphite-app
Copy link
Copy Markdown
Contributor

graphite-app bot commented Dec 11, 2025

Merge activity

@overlookmotel overlookmotel force-pushed the 12-11-test_linter_plugins_conformance_tester_avoid_repeated_loops_creating_report branch from 6c6af18 to 5bcc2cd Compare December 11, 2025 11:48
…g report (#16739)

Pure refactor to conformance tester. The code written by Claude looped over the same arrays 10+ times, and was hard to read. Instead, categorize rule results once at the start of preparing the report. Ditto for summary stats output to `stdout`.
@graphite-app graphite-app bot force-pushed the 12-11-test_linter_plugins_conformance_tester_avoid_repeated_loops_creating_report branch from 5bcc2cd to e8290b1 Compare December 11, 2025 11:50
@graphite-app graphite-app bot merged commit e8290b1 into main Dec 11, 2025
18 checks passed
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Dec 11, 2025
@graphite-app graphite-app bot deleted the 12-11-test_linter_plugins_conformance_tester_avoid_repeated_loops_creating_report branch December 11, 2025 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-cli Area - CLI A-linter Area - Linter A-linter-plugins Area - Linter JS plugins C-test Category - Testing. Code is missing test cases, or a PR is adding them

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants