Skip to content

fix(linter): add summary output to GitHub formatter#20404

Merged
camc314 merged 2 commits intooxc-project:mainfrom
Hideyasu-Ozawa:fix/github-formatter-summary
Mar 16, 2026
Merged

fix(linter): add summary output to GitHub formatter#20404
camc314 merged 2 commits intooxc-project:mainfrom
Hideyasu-Ozawa:fix/github-formatter-summary

Conversation

@Hideyasu-Ozawa
Copy link
Copy Markdown
Contributor

@Hideyasu-Ozawa Hideyasu-Ozawa commented Mar 15, 2026

Fixes #20402

Summary

  • GitHub formatter produces no stdout when diagnostics are 0, unlike default and gitlab formatters
  • This causes downstream tools that parse stdout (e.g. vite-plus) to fail in GitHub Actions
  • Reuse get_diagnostic_result_output() from default.rs so finish() returns Found X warnings and Y errors. instead of None

Changes

File Change
default.rs Change get_diagnostic_result_output visibility to pub(super)
github.rs finish() returns Some(get_diagnostic_result_output(result)) instead of None; update existing test + add new test
4 snapshot files Add summary line to GitHub formatter snapshots

::warning / ::error annotations are unaffected. The summary line simply appears in the CI log.

Test plan

  • Existing unit test updated (reporter_finish asserts summary content instead of None)
  • New test reporter_finish_with_errors added for non-zero diagnostics
  • All 4 GitHub formatter snapshot tests updated and passing
  • Manual verification: GITHUB_ACTIONS=true ./target/debug/oxlint --format github outputs summary on 0 diagnostics
  • just ready passes
  • CI passes

This PR was developed with assistance from AI tools (Claude).
All changes have been reviewed and tested.

@Hideyasu-Ozawa Hideyasu-Ozawa requested a review from camc314 as a code owner March 15, 2026 14:22
Copilot AI review requested due to automatic review settings March 15, 2026 14:22
@github-actions github-actions bot added A-linter Area - Linter A-cli Area - CLI C-bug Category - Bug labels Mar 15, 2026
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

Updates oxlint’s GitHub Actions output formatter so it always emits a summary line even when there are zero diagnostics, aligning behavior with other formatters and preventing downstream tools from failing on empty stdout in CI.

Changes:

  • Expose get_diagnostic_result_output to sibling formatters (pub(super)) for reuse.
  • Make the GitHub reporter’s finish() return the standard summary string instead of None.
  • Update/add unit + snapshot tests to assert the presence of the summary output for GitHub formatting.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
apps/oxlint/src/output_formatter/default.rs Makes the shared summary-rendering helper available to sibling formatters.
apps/oxlint/src/output_formatter/github.rs Ensures finish() always returns the standard summary output; updates/extends unit tests.
apps/oxlint/src/snapshots/fixtures__cli__output_formatter_diagnostic_--format=github ok.js@oxlint.snap Snapshot now includes the summary line for the zero-diagnostics GitHub formatter run.
apps/oxlint/src/snapshots/fixtures__cli__output_formatter_diagnostic_--format=github test.js@oxlint.snap Snapshot includes the summary line after GitHub annotations.
apps/oxlint/src/snapshots/fixtures__cli__output_formatter_diagnostic_--format=github parser-error.js@oxlint.snap Snapshot includes the summary line for the parser-error GitHub formatter run.
apps/oxlint/src/snapshots/fixtures__cli__output_formatter_diagnostic_--format=github --report-unused-disable-directives disable-directive.js@oxlint.snap Snapshot includes the summary line for unused-disable-directives output in GitHub format.

Copy link
Copy Markdown
Contributor

@camc314 camc314 left a comment

Choose a reason for hiding this comment

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

thanks

@camc314 camc314 self-assigned this Mar 16, 2026
@camc314 camc314 changed the title fix(oxlint): add summary output to GitHub formatter on zero diagnostics fix(linter): add summary output to GitHub formatter Mar 16, 2026
@camc314 camc314 merged commit 4791b2e into oxc-project:main Mar 16, 2026
19 checks passed
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 C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

linter: GitHub formatter produces no output when there are zero diagnostics

3 participants