test(linter/plugins): conformance tester avoid repeated loops creating report#16739
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
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. |
There was a problem hiding this comment.
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, andfailingRulesarrays - Replaced multiple
filter()andreduce()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.
69f77ec to
4416b34
Compare
90b1406 to
ee0f103
Compare
ee0f103 to
6c6af18
Compare
Merge activity
|
6c6af18 to
5bcc2cd
Compare
…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`.
5bcc2cd to
e8290b1
Compare

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.