Repository navigation
fix(cargo-heather): warn on unresolvable exclude entries and document exclude key - #37
Merged
Merged
Conversation
… exclude key Previously, exclude entries that could not be resolved by std::fs::canonicalize (e.g. glob patterns, typos, or paths to non-existent files) were silently dropped via filter_map(... .ok()). This made it appear as though the tool was ignoring the user's config. Now a warning is printed for each exclude entry that cannot be resolved, while still allowing the scan to proceed (a hard error would break setups where excluded directories only exist in some environments). Also documents the exclude configuration key in the README, noting that entries are literal paths (not globs) relative to the project root. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #37 +/- ##
=====================================
Coverage 93.1% 93.1%
=====================================
Files 28 28
Lines 1235 1241 +6
=====================================
+ Hits 1150 1156 +6
Misses 85 85 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves cargo-heather’s handling and documentation of the .cargo-heather.toml exclude list by surfacing previously silent failures when an exclude entry can’t be canonicalized (e.g., typos or non-existent paths), and by documenting how exclude works.
Changes:
- Emit a warning when an
excludeentry cannot be resolved/canonicalized, while continuing the scan. - Add README documentation describing the
excludekey semantics and limitations (no glob support). - Add an end-to-end CLI test covering mixed valid + invalid exclude entries and asserting both “still excludes” and “warns”.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
crates/cargo-heather/src/bin/cargo-heather/scanner.rs |
Adds warning output when exclude entries cannot be canonicalized and are therefore ignored. |
crates/cargo-heather/tests/cli.rs |
Adds integration test ensuring invalid excludes produce a warning and valid excludes still filter files. |
crates/cargo-heather/README.md |
Documents exclude configuration behavior and clarifies that glob patterns aren’t supported. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Evgenii (Vaiz)
approved these changes
Jun 4, 2026
Sander Saares (sandersaares)
approved these changes
Jun 4, 2026
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
Previously, exclude entries in
.cargo-heather.tomlthat could not be resolved bystd::fs::canonicalize(e.g. glob patterns, typos, or paths to non-existent files) were silently dropped. This made it appear as though the tool was ignoring the user's configuration.Changes
scanner.rs- Emit a warning for each unresolvable exclude entry. The scan still proceeds (warning, not error).README.md- Document the exclude config key: literal paths, relative to project root, directory entries exclude the whole subtree.cli.rs- Add test with mixed valid + invalid excludes verifying the warning is emitted and valid excludes still work.Note on glob support
Glob/wildcard pattern support in exclude is a separate feature request, not a bug fix. This PR addresses only the silent-failure usability issue and the documentation gap.