Skip to content

test(linter/plugins): print percentages in conformance tester report summary#16781

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

test(linter/plugins): print percentages in conformance tester report summary#16781
graphite-app[bot] merged 1 commit intomainfrom
12-12-test_linter_plugins_print_percentages_in_report_summary

Conversation

@overlookmotel
Copy link
Copy Markdown
Member

@overlookmotel overlookmotel commented Dec 12, 2025

Include percentages in summaries at top of conformance tester report.

Copy link
Copy Markdown
Member Author

overlookmotel commented Dec 12, 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.

@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 12, 2025
@overlookmotel overlookmotel changed the title test(linter/plugins): print percentages in report summary test(linter/plugins): print percentages in conformance tester report summary Dec 12, 2025
@overlookmotel overlookmotel marked this pull request as ready for review December 12, 2025 17:19
Copilot AI review requested due to automatic review settings December 12, 2025 17:19
@overlookmotel overlookmotel self-assigned this Dec 12, 2025
Copy link
Copy Markdown

@charliecreates charliecreates bot left a comment

Choose a reason for hiding this comment

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

The new % column is a useful improvement, but formatPercent() currently divides by zero when total === 0, producing NaN% and potentially breaking reports/snapshots for edge cases. The table alignment logic also hard-codes padding widths, which is somewhat brittle if percent formatting or inputs change.

Additional notes (1)
  • Maintainability | apps/oxlint/conformance/src/report.ts:99-101
    countAndPercent() hard-codes padding widths (padStart(5) and padStart(6)) while the table header is | % | (6 chars including spaces). This will misalign if percentages ever exceed 100.0% (possible if count > total due to data issues) or if formatting changes (e.g., 100.00%). Consider making the widths named constants or deriving them from expected formats to avoid fragile alignment logic embedded in string concatenation.
Summary of changes

What changed

  • Updated the conformance report summary tables to include a new percentage (%) column for both Rules and Tests.
  • Replaced the previous pad5() helper with a new countAndPercent() helper that formats both the padded count and a padded percent string.
  • Refactored formatProportion() to reuse a new formatPercent() helper.
  • Updated the snapshot (apps/oxlint/conformance/snapshot.md) to match the new report output, including aligned percent values like 100.0%, 73.4%, etc.

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 enhances the conformance tester report by adding percentage columns to the summary tables, providing better visibility into test coverage and success rates at a glance. The change extracts percentage calculation logic into a reusable function and updates both the Rules and Tests summary tables to display percentages alongside counts.

Key Changes

  • Introduced formatPercent function to calculate and format percentages
  • Refactored formatProportion to use the new formatPercent function for consistency
  • Added percentage columns to both Rules and Tests summary tables

Reviewed changes

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

File Description
apps/oxlint/conformance/src/report.ts Adds formatPercent helper function, creates countAndPercent helper for table formatting, refactors formatProportion to use formatPercent, and updates summary table headers and rows to include percentage columns
apps/oxlint/conformance/snapshot.md Updates snapshot with expected output showing percentage columns in both Rules and Tests summary tables

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

@overlookmotel overlookmotel added the 0-merge Merge with Graphite Merge Queue label Dec 12, 2025
Copy link
Copy Markdown
Member Author

overlookmotel commented Dec 12, 2025

Merge activity

…summary (#16781)

Include percentages in summaries at top of conformance tester report.
@graphite-app graphite-app bot force-pushed the 12-12-test_linter_plugins_refactor_report_creation branch from 831fc57 to 1fde9b6 Compare December 12, 2025 17:28
@graphite-app graphite-app bot force-pushed the 12-12-test_linter_plugins_print_percentages_in_report_summary branch from 2bfa299 to 2124d03 Compare December 12, 2025 17:28
Base automatically changed from 12-12-test_linter_plugins_refactor_report_creation to main December 12, 2025 17:34
@graphite-app graphite-app bot merged commit 2124d03 into main Dec 12, 2025
19 checks passed
@graphite-app graphite-app bot deleted the 12-12-test_linter_plugins_print_percentages_in_report_summary branch December 12, 2025 17:34
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Dec 12, 2025
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