feat(covgate): add --exclude flag to skip packages from coverage measurement#29
Merged
Conversation
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
… and full removal
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
6 tasks
ben-miru
added a commit
that referenced
this pull request
May 15, 2026
…table (#30) ## Summary - Render each `--exclude`d package as a `SKIPPED` row in the per-package coverage table with `---` placeholders for COVERAGE/REQUIRED/TIME, grouped at the end after measured rows. - Widen the `STATUS` column from 6 to 7 chars so `SKIPPED` fits without breaking alignment of existing `PASS`/`FAIL`/`LOOSE` rows. - Follow-up to #29: the existing `Excluded N package(s)` summary line told users *how many* packages were excluded but not *which ones*. This change surfaces them by name. The summary line is preserved and the pass/fail tally is unaffected — `SKIPPED` rows never flip a successful run to failure. ## Sample output ``` Checking per-package coverage (default minimum: 80.0%)... Excluded 1 package(s) from coverage measurement STATUS COVERAGE REQUIRED TIME PACKAGE ------- -------- -------- -------- ------- PASS 90.0% 80.0% 0.5s pkg/a PASS 85.2% 80.0% 0.4s pkg/c SKIPPED --- --- --- pkg/b Total time: 0.9s All packages meet minimum coverage requirement ``` ## Test plan - [ ] `SKIPPED` row renders for each `--exclude`d package - [ ] `SKIPPED` rows appear after all measured rows in the table - [ ] `SKIPPED` packages do not count toward the failure tally (run succeeds when all measured packages pass) - [ ] All-excluded case: run succeeds with every package as a `SKIPPED` row - [ ] Existing `TestRun_Exclude` subtests pass with updated assertions - [ ] `./scripts/preflight.sh` reports `=== All checks passed ===` Full design and rationale: `plans/completed/20260515-covgate-skipped-rows.md`. [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--excludeflag tomiru covgatethat takes a comma-separated list of Go list patterns (e.g../pkg/b,./internal/foo/...) and removes the resolved import paths from the coverage measurement set before tests run. Patterns are resolved viago listso they share the same dialect as--packages, wildcards expand correctly, and whitespace around comma-separated entries is tolerated.Excluded N package(s) from coverage measurementbetween the intro line and the results table. No-op patterns (matching zero packages) and unset/empty--excludeproduce byte-identical output to today, so existing CI invocations are unaffected.backend/repo: some packages exercise cloud services (AWS, Cloudflare) in their tests and cannot run locally without cloud credentials.--excludelets developers skip those packages locally while CI continues to measure everything by omitting the flag.Test plan
TestRun_Exclude_NoExclude— emptyExcludepreserves existing output exactly; no "Excluded" notice.TestRun_Exclude_Subset— single pattern removes one package; "Excluded 1 package(s)" notice appears.TestRun_Exclude_NoOpPattern— pattern that resolves to zero packages leaves the list untouched and suppresses the notice.TestRun_Exclude_MultiplePatternsWithWhitespace—"./pkg/a, ./pkg/c"(with whitespace) is trimmed correctly and removes both.TestRun_Exclude_AllPackages— excluding everything produces a clean run with no per-package rows and the standard "All packages meet minimum coverage requirement" tail.TestRun_Exclude_GoListError—go listfailure on an exclude pattern is wrapped withresolve exclude %q: %wand propagated.TestNewCovgateCommand_Flags/TestNewCovgateCommand_FlagDefaults— CLI flag wiring asserts--excludeexists as a string flag with default""../scripts/preflight.sh(lint + covgate + surface lint) passes locally.Plan:
plans/completed/20260515-covgate-exclude-flag.md.Generated with Claude Code