Skip to content

feat: add --min-coverage and --max-annotations flags#294

Merged
mcarvin8 merged 2 commits into
mainfrom
feat/min-coverage-max-annotations-flags
May 29, 2026
Merged

feat: add --min-coverage and --max-annotations flags#294
mcarvin8 merged 2 commits into
mainfrom
feat/min-coverage-max-annotations-flags

Conversation

@mcarvin8
Copy link
Copy Markdown
Owner

Summary

  • --min-coverage (integer, 0–100, optional): Fails the command with a non-zero exit code if overall Apex line coverage is below the threshold. Reports are written before the check so the output is always available for debugging.
  • --max-annotations (integer, ≥1, default 50): Overrides the maximum number of ::warning annotations emitted by --format github-actions. Annotations beyond the cap are summarised in a ::notice line. Exposes the previously-hardcoded constant so CI teams can tune it.

Internal changes:

  • transformCoverageReport now returns lineRate alongside finalPaths and warnings
  • processDeployCoverage and processTestCoverage accumulate line totals to compute the overall rate
  • ReportRenderOptions threads maxAnnotations from the transformer through reportGenerator into generateGitHubActions

Test plan

  • 112 unit tests pass (npm run test:only) — 100% branch coverage (205/205)
  • minCoverage: 0 resolves without error
  • minCoverage: 100 throws with message matching /below the required minimum of 100%/
  • maxAnnotations: 2 override via generateAndWriteReport options caps warnings at 2 with truncation notice
  • maxAnnotations: 1 passed through transformCoverageReport to the generator

🤖 Generated with Claude Code

--min-coverage (0–100): fails the command with a non-zero exit code if
overall Apex line coverage is below the threshold. Reports are written
before the check so the output is always available for inspection.

--max-annotations (≥1, default 50): overrides the maximum number of
::warning annotations emitted by the github-actions format. Annotations
beyond the cap are summarised in a ::notice line. Exposes the previously
hardcoded DEFAULT_MAX_ANNOTATIONS constant as a named export so the
command can reference the default in the flag definition.

Internal: transformCoverageReport now returns lineRate alongside
finalPaths and warnings. processDeployCoverage and processTestCoverage
return line totals used to compute the overall rate. ReportRenderOptions
threads maxAnnotations from the transformer through reportGenerator into
generateGitHubActions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
src/transformers/coverageTransformer.ts 100.00% <100.00%> (ø)
...c/transformers/generators/generateGitHubActions.ts 100.00% <100.00%> (ø)
src/transformers/reportGenerator.ts 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

--min-coverage is intentionally optional with no default — omitting it
disables the threshold check entirely. The rule does not apply here.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@mcarvin8 mcarvin8 merged commit 0eb4de9 into main May 29, 2026
11 checks passed
@mcarvin8 mcarvin8 deleted the feat/min-coverage-max-annotations-flags branch May 29, 2026 13:47
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.

2 participants