Skip to content

feat(check): add --max-warnings flag to fail on warnings#374

Merged
rhuanbarreto merged 5 commits into
mainfrom
claude/hardcore-lichterman-88dcb2
May 28, 2026
Merged

feat(check): add --max-warnings flag to fail on warnings#374
rhuanbarreto merged 5 commits into
mainfrom
claude/hardcore-lichterman-88dcb2

Conversation

@rhuanbarreto

Copy link
Copy Markdown
Contributor

Summary

Adds an ESLint/oxlint-style --max-warnings <n> flag to archgate check, so warnings can be promoted to failures — the same capability every major linter offers.

  • --max-warnings <n> makes archgate check exit 1 when the total warning count exceeds n. --max-warnings 0 fails on any warning.
  • Without the flag, behavior is unchanged: warnings (diagnostics and rule-reported severity: "warning") never affect the exit code.
  • The report summary gains a warningsExceeded field that folds into pass, keeping console / --json / --ci status and telemetry consistent. The console reporter prints a note explaining a warning-triggered failure.
  • Invalid values (NaN, negative) are rejected with a clear error and exit 1.

Implementation notes

  • Option defined with new Option().argParser() + .addOption() per ARCH-008 (typed command options).
  • buildSummary(result, { maxWarnings }) computes warningsExceeded; getExitCode returns 1 when it is set (rule-execution errors still take precedence with exit 2).
  • EMPTY_SUMMARY and the telemetry trackCheckResult signature (used_max_warnings) updated accordingly.
  • Docs updated in both EN and pt-br (GEN-002 i18n parity).

Test plan

  • bun run lint / typecheck / format:check
  • bun test — added unit tests (tests/engine/reporter.test.ts) and integration tests (tests/integration/check-max-warnings.test.ts) covering: warnings ignored without the flag, exit 1 at --max-warnings 0, tolerance up to threshold, rule-error precedence, and invalid-value rejection
  • archgate check passes (31/31 rules)
  • bun run knip fails on pre-existing tooling-binary noise (oxlint/oxfmt/knip/czg/conventional-changelog) — unrelated to this change; reproduces on a clean tree

🤖 Generated with Claude Code

rhuanbarreto and others added 2 commits May 29, 2026 01:15
Adds an ESLint/oxlint-style `--max-warnings <n>` option to `archgate
check`. When the total warning count exceeds the threshold, the check
fails with exit 1. `--max-warnings 0` fails on any warning. Without the
flag, warnings continue to have no effect on the exit code.

The summary now carries a `warningsExceeded` field which folds into
`pass`, so console/JSON/CI status and telemetry stay consistent.

Docs (EN + pt-br) and tests updated.

Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented May 28, 2026

Copy link
Copy Markdown

Deploying archgate-cli with  Cloudflare Pages  Cloudflare Pages

Latest commit: 602da0b
Status: ✅  Deploy successful!
Preview URL: https://3b9eb6a4.archgate-cli.pages.dev
Branch Preview URL: https://claude-hardcore-lichterman-8.archgate-cli.pages.dev

View logs

…erman-88dcb2

# Conflicts:
#	tests/helpers/telemetry.test.ts
Resolves merge with main: adopt main's expect().not.toThrow() telemetry
test style (merging the two trackCheckResult cases to stay under the
500-line lint cap) and add the --max-warnings docs to the new nb locale
mirror so GEN-002 i18n-translation-drift passes.

Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
@github-actions

Copy link
Copy Markdown
Contributor

Code Coverage

Metric Value
Lines 90.2% (6591 / 7310)
Threshold 90% minimum — met
Platforms Linux + Windows

Full HTML report available in workflow artifacts.

Per-directory breakdown
Directory Coverage Lines
src/commands/ 88.0% 2082 / 2365
src/engine/ 92.9% 1219 / 1312
src/formats/ 100.0% 141 / 141
src/helpers/ 90.2% 3149 / 3492

@rhuanbarreto rhuanbarreto merged commit 20920de into main May 28, 2026
19 checks passed
@rhuanbarreto rhuanbarreto deleted the claude/hardcore-lichterman-88dcb2 branch May 28, 2026 23:32
@archgatebot archgatebot Bot mentioned this pull request May 28, 2026
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.

1 participant