Skip to content

feat: add junit output support to scorecard-classic#2727

Merged
RomanHotsiy merged 11 commits intomainfrom
codex/scorecard-classic-junit-output
Apr 10, 2026
Merged

feat: add junit output support to scorecard-classic#2727
RomanHotsiy merged 11 commits intomainfrom
codex/scorecard-classic-junit-output

Conversation

@RomanHotsiy
Copy link
Copy Markdown
Member

@RomanHotsiy RomanHotsiy commented Apr 8, 2026

What/Why/How?

Adds junit as a supported scorecard-classic output format so CI systems can ingest scorecard results as test reports.

Implementation details:

  • add a dedicated JUnit formatter for scorecard-classic
  • wire --format=junit into the CLI command and argument typing
  • cover the formatter with unit tests for empty, error, warning, escaping, and missing-location cases
  • document the new output format and add a changeset

Reference

N/A

Testing

  • npx vitest run packages/cli/src/commands/scorecard-classic/__tests__/checkstyle-formatter.test.ts packages/cli/src/commands/scorecard-classic/__tests__/json-formatter.test.ts packages/cli/src/commands/scorecard-classic/__tests__/stylish-formatter.test.ts packages/cli/src/commands/scorecard-classic/__tests__/junit-formatter.test.ts
  • npx tsc --noEmit --skipLibCheck
  • pre-commit hooks ran npm run lint, npm run lint:fix, and npm run format

Screenshots (optional)

N/A

Check yourself

  • This PR follows the contributing guide
  • All new/updated code is covered by tests
  • Core code changed? - Tested with other Redocly products (internal contributions only)
  • New package installed? - Tested in different environments (browser/node)
  • Documentation update has been considered

Security

  • The security impact of the change has been considered
  • Code follows company security practices and guidelines

Note

Low Risk
Low risk additive change: introduces a new junit output formatter and wires it into scorecard-classic without altering validation logic. Main risk is output format correctness/escaping for CI consumers, mitigated by new unit tests.

Overview
scorecard-classic now supports --format=junit, emitting JUnit XML with one suite per run and one case per issue (errors as failures, warnings as skipped), including escaped details and location fallbacks.

This wires the new formatter into CLI argument choices/types, factors ANSI-stripping into a shared stripAnsiCodes utility (reused by JSON output), adds dedicated unit tests for the JUnit output, and updates docs plus a changeset announcing the new format.

Reviewed by Cursor Bugbot for commit de1255b. Bugbot is set up for automated code reviews on this repo. Configure here.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 8, 2026

🦋 Changeset detected

Latest commit: de1255b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@redocly/cli Minor
@redocly/openapi-core Minor
@redocly/respect-core Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 79.96% (🎯 79%) 6729 / 8415
🔵 Statements 79.39% (🎯 79%) 6967 / 8775
🔵 Functions 83.02% (🎯 82%) 1365 / 1644
🔵 Branches 71.61% (🎯 71%) 4569 / 6380
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/cli/src/commands/scorecard-classic/index.ts 0% 0% 0% 0% 35-187
packages/cli/src/commands/scorecard-classic/formatters/json-formatter.ts 96.66% 86.66% 100% 96.42% 37
packages/cli/src/commands/scorecard-classic/formatters/junit-formatter.ts 100% 100% 100% 100%
packages/cli/src/utils/strip-ansi-codes.ts 100% 100% 100% 100%
Generated in workflow #9390 for commit de1255b by the Vitest Coverage Report Action

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

CLI Version Mean Time ± Std Dev (s) Relative Performance (Lower is Faster)
cli-latest 3.570s ± 0.041s ▓▓▓ 1.10x
cli-next 3.255s ± 0.027s ▓ 1.00x (Fastest)

@RomanHotsiy RomanHotsiy changed the title Add junit output support to scorecard-classic feat: add junit output support to scorecard-classic Apr 9, 2026
@RomanHotsiy RomanHotsiy marked this pull request as ready for review April 9, 2026 06:20
@RomanHotsiy RomanHotsiy requested review from a team as code owners April 9, 2026 06:20
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit d1cad80. Configure here.

@RomanHotsiy RomanHotsiy merged commit 955c91c into main Apr 10, 2026
47 checks passed
@RomanHotsiy RomanHotsiy deleted the codex/scorecard-classic-junit-output branch April 10, 2026 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants