Commit 237718adb834
Changed files (2)
tools
review-tool
internal
filter
tools/review-tool/internal/filter/filter.go
@@ -55,17 +55,19 @@ func (f *Filter) FilterItems(items []activity.ActivityItem) []activity.ActivityI
func (f *Filter) Match(item activity.ActivityItem) bool {
folders := itemFolders(item)
+ // Items with no folder metadata are dropped when any folder filter is active.
+ // They can't be classified, so they shouldn't slip through.
+ if len(folders) == 0 {
+ return false
+ }
+
// Exclude check: if any folder matches an exclude pattern, reject
if len(f.ExcludeFolders) > 0 && matchesAny(folders, f.ExcludeFolders) {
return false
}
// Include check: at least one folder must match an include pattern
- // Items with no folder metadata pass include filters (they can't be classified)
if len(f.IncludeFolders) > 0 {
- if len(folders) == 0 {
- return false
- }
return matchesAny(folders, f.IncludeFolders)
}
tools/review-tool/internal/filter/filter_test.go
@@ -49,7 +49,7 @@ func TestFilter_ExcludeFolder(t *testing.T) {
{"excludes home project", item(map[string]string{"project": "~/src/home (homelab)"}), false},
{"excludes home dir", item(map[string]string{"directory": "~/src/home"}), false},
{"keeps tektoncd", item(map[string]string{"project": "tektoncd/pipeline"}), true},
- {"no metadata passes", item(map[string]string{}), true},
+ {"no metadata excluded", item(map[string]string{}), false},
}
for _, tt := range tests {