Skip to content

Commit 26b03d9

Browse files
Added support for rs files. (AST-68753) (#916)
* add .rs to include filters * fix linter --------- Co-authored-by: Or Shamir Checkmarx <[email protected]>
1 parent fa583fb commit 26b03d9

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

internal/commands/scan_test.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,3 +1187,33 @@ func TestValidateContainerImageFormat(t *testing.T) {
11871187
})
11881188
}
11891189
}
1190+
1191+
func TestFilterMatched(t *testing.T) {
1192+
tests := []struct {
1193+
name string
1194+
filters []string
1195+
fileName string
1196+
expected bool
1197+
}{
1198+
{
1199+
name: "whenFileMatchesInclusionFilter_shouldReturnTrue",
1200+
filters: []string{"*.go"},
1201+
fileName: "main.go",
1202+
expected: true,
1203+
},
1204+
{
1205+
name: "whenFileNoMatchesInclusionFilter_shouldReturnFalse",
1206+
filters: []string{"*.go"},
1207+
fileName: "main.py",
1208+
expected: false,
1209+
},
1210+
}
1211+
1212+
for _, tt := range tests {
1213+
tt := tt
1214+
t.Run(tt.name, func(t *testing.T) {
1215+
result := filterMatched(tt.filters, tt.fileName)
1216+
assert.Equal(t, tt.expected, result)
1217+
})
1218+
}
1219+
}

internal/params/filters.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ var BaseIncludeFilters = []string{
135135
"Podfile.lock",
136136
"*.cmp",
137137
"Directory.Packages.props",
138+
"*.rs",
138139
}
139140

140141
var BaseExcludeFilters = []string{

0 commit comments

Comments
 (0)