Skip to content

fix(cargo-heather): warn on unresolvable exclude entries and document exclude key - #37

Merged
Sergey Galkin (sgalkin) merged 2 commits into
mainfrom
u/sgalkin/heather-diagnostics
Jun 4, 2026
Merged

Sergey Galkin (sgalkin) merged 2 commits into
mainfrom
u/sgalkin/heather-diagnostics

Conversation

@sgalkin

Copy link
Copy Markdown
Contributor

Summary

Previously, exclude entries in .cargo-heather.toml that could not be resolved by std::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.

… 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>
Copilot AI review requested due to automatic review settings June 4, 2026 10:08
@codecov-commenter

Codecov Comments Bot (codecov-commenter) commented Jun 4, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.1%. Comparing base (9bda797) to head (67f97c2).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 exclude entry cannot be resolved/canonicalized, while continuing the scan.
  • Add README documentation describing the exclude key 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.

Comment thread crates/cargo-heather/README.md
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 4, 2026 10:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@sgalkin
Sergey Galkin (sgalkin) merged commit a5dd45a into main Jun 4, 2026
26 checks passed
@sgalkin
Sergey Galkin (sgalkin) deleted the u/sgalkin/heather-diagnostics branch June 4, 2026 10:43
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.

5 participants