Skip to content

Commit

Permalink
add .rs to include filters
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahCx committed Oct 28, 2024
1 parent 8bcbea2 commit ca5084e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
29 changes: 29 additions & 0 deletions internal/commands/scan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1178,3 +1178,32 @@ func TestValidateContainerImageFormat(t *testing.T) {
})
}
}

func TestFilterMatched(t *testing.T) {
tests := []struct {
name string
filters []string
fileName string
expected bool
}{
{
name: "whenFileMatchesInclusionFilter_shouldReturnTrue",
filters: []string{"*.go"},
fileName: "main.go",
expected: true,
},
{
name: "whenFileNoMatchesInclusionFilter_shouldReturnFalse",
filters: []string{"*.go"},
fileName: "main.py",
expected: false,
},
}

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
result := filterMatched(tt.filters, tt.fileName)
assert.Equal(t, tt.expected, result)
})
}
}
1 change: 1 addition & 0 deletions internal/params/filters.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ var BaseIncludeFilters = []string{
"Podfile.lock",
"*.cmp",
"Directory.Packages.props",
"*.rs",
}

var BaseExcludeFilters = []string{
Expand Down

0 comments on commit ca5084e

Please sign in to comment.