Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes an issue where the --not-match flag (which accepts regular expressions to exclude files and directories) was only matching against filenames and directory names rather than the full file paths. The fix adds an additional filtering layer that applies the regex patterns against the complete file paths after files are discovered by the fileWalker.
Changes:
- Introduced
excludePathRegexesvariable to store compiled regex patterns for path-level filtering - Added path-based exclusion logic that filters files from
potentialFilesQueueby matching regex patterns against full file paths (fi.Location)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| for _, f := range filePaths { | ||
| fileInfo, err := os.Lstat(f) | ||
| if err != nil { | ||
| continue | ||
| } | ||
|
|
||
| fileJob := newFileJob(f, f, fileInfo) | ||
| if fileJob != nil { | ||
| fileListQueue <- fileJob | ||
| } | ||
| } |
There was a problem hiding this comment.
The exclude path regex filtering is not applied to directly specified files. This creates an inconsistency where users can specify a file path directly as an argument and it will be processed even if it matches an exclude pattern. For consistency with the filtering logic applied to discovered files (lines 608-617), consider applying the same exclude path regex check here.
| shouldExclude := false | ||
| for _, re := range excludePathRegexes { | ||
| if re.MatchString(fi.Location) { | ||
| shouldExclude = true | ||
| break | ||
| } | ||
| } | ||
| if shouldExclude { | ||
| continue | ||
| } |
There was a problem hiding this comment.
The PR title references "issue 678" but there's no corresponding test case following the project's convention. The codebase has a consistent pattern of adding integration tests named TestIssue{number} in main_test.go for bug fixes (e.g., TestIssue457, TestIssue564). Consider adding a TestIssue678 test case that demonstrates the issue being fixed and validates the solution.
No description provided.