Repository navigation
Fix exclude filters skipping adjacent files and directories - #176
Merged
Merged
Conversation
When document() applied exclude filters, it removed matching entries from the subdirs and filenames lists while iterating over those same lists. Each removal shifted the list, so the entry following an excluded one was never checked, and an excluded file or directory next to another excluded one was still documented. Iterate over a copy of each list, as is already done for the auto_exclude_directories_without_cmake check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: R Kent James <kent@caspia.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #176 +/- ##
=======================================
Coverage 97.16% 97.16%
=======================================
Files 8 8
Lines 986 986
=======================================
Hits 958 958
Misses 28 28
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🟢 Approval recommended
The focused changes fix both affected loops, preserve directory pruning, and include regression coverage with no unresolved findings.
No open issues 🎉
What changed in this PR
This PR fixes CMinx exclusion filtering so adjacent excluded files and directories are not accidentally documented.
Changes:
- Iterate over copies of directory and filename lists while removing excluded entries from the originals.
- Add a regression test that verifies adjacent exclusions and confirms retained entries are documented.
| File | Description |
|---|---|
tests/unit_tests/test_config.py |
Adds regression coverage for adjacent file and directory exclusions. |
src/cminx/__init__.py |
Prevents skipped entries while preserving in-place directory pruning. |
Review effort: Balanced
Collaborator
|
Thanks for the contribution! The changes look great! |
|
🚀 [bumpr] Bumped! |
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.
While implementing CMinx to document ament_cmake, Claude Opus 5.5 reported as an aside that there was a bug in CMinx. Then when running CMinx with a number of files excluded, some files showed that were not supposed to because of the bug.
Claude seemed to know what to do, so I let it do it. The result is below. It looks useful to me, but I don't really know CMinx other than as a user.
Claude says:
When document() applied exclude filters, it removed matching entries from the subdirs and filenames lists while iterating over those same lists. Each removal shifted the list, so the entry following an excluded one was never checked, and an excluded file or directory next to another excluded one was still documented.
Iterate over a copy of each list, as is already done for the auto_exclude_directories_without_cmake check.
Is this pull request associated with an issue(s)?
No
Description
This will prevent excludes from inadvertently including adjacent directories.