Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions internal/config/rules/system_rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ func (f *FileFilter) IsUserExcluded(path string) bool {
for _, pattern := range f.Exclude {
expanded := expandBraces(pattern)
for _, p := range expanded {
if matched, _ := doublestar.Match(p, lowerPath); matched {
if matched, _ := doublestar.Match(strings.ToLower(p), lowerPath); matched {
return true
}
}
Expand All @@ -242,7 +242,7 @@ func (f *FileFilter) IsUserIncluded(path string) bool {
for _, pattern := range f.Include {
expanded := expandBraces(pattern)
for _, p := range expanded {
if matched, _ := doublestar.Match(p, lowerPath); matched {
if matched, _ := doublestar.Match(strings.ToLower(p), lowerPath); matched {
return true
}
}
Expand Down
12 changes: 10 additions & 2 deletions internal/config/rules/system_rules_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -677,8 +677,8 @@ func TestFileFilter_IsUserIncluded_EmptyInclude(t *testing.T) {

func TestFileFilter_CaseInsensitive(t *testing.T) {
f := &FileFilter{
Include: []string{"src/**/*.java"},
Exclude: []string{"**/generated/**"},
Include: []string{"src/**/*.java", "**/CHANGELOG.md"},
Exclude: []string{"**/generated/**", "README.md"},
}

if !f.IsUserIncluded("SRC/Main/Foo.Java") {
Expand All @@ -687,6 +687,14 @@ func TestFileFilter_CaseInsensitive(t *testing.T) {
if !f.IsUserExcluded("SRC/Generated/Api.java") {
t.Errorf("expected case-insensitive exclude match")
}

// Verify patterns containing uppercase letters also match.
if !f.IsUserIncluded("docs/changelog.md") {
t.Errorf("expected uppercase include pattern to match case-insensitively")
}
if !f.IsUserExcluded("readme.md") {
t.Errorf("expected uppercase exclude pattern to match case-insensitively")
}
}

func TestNewResolver_FileFilterMerged(t *testing.T) {
Expand Down
Loading