Skip to content

Commit c1172b1

Browse files
committed
Fixed issue when scan was not happening in case of checksum mismatch
1 parent b6f13ba commit c1172b1

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

detector/filename_detector_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ func shouldNotFailWithDefaultDetectorAndIgnores(fileName, ignore string, t *test
143143

144144
fileIgnoreConfig := FileIgnoreConfig{}
145145
fileIgnoreConfig.FileName = ignore
146+
fileIgnoreConfig.IgnoreDetectors = make([]string, 1)
147+
fileIgnoreConfig.IgnoreDetectors[0] = "filename"
146148
talismanRCIgnore := TalismanRCIgnore{}
147149
talismanRCIgnore.FileIgnoreConfig = make([]FileIgnoreConfig, 1)
148150
talismanRCIgnore.FileIgnoreConfig[0] = fileIgnoreConfig

detector/filesize_detector_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ func TestShouldNotFlagIgnoredLargeFiles(t *testing.T) {
3131
filename := "filename"
3232
fileIgnoreConfig := FileIgnoreConfig{}
3333
fileIgnoreConfig.FileName = filename
34+
fileIgnoreConfig.IgnoreDetectors = make([]string, 1)
35+
fileIgnoreConfig.IgnoreDetectors[0] = "filesize"
3436
talismanRCIgnore := TalismanRCIgnore{}
3537
talismanRCIgnore.FileIgnoreConfig = make([]FileIgnoreConfig, 1)
3638
talismanRCIgnore.FileIgnoreConfig[0] = fileIgnoreConfig

detector/ignores.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func NewIgnore(pattern string, comment string) Ignore {
9898

9999
func (i FileIgnoreConfig) isEffective(detectorName string) bool {
100100
return !isEmptyString(i.FileName) &&
101-
(contains(i.IgnoreDetectors, detectorName) || len(i.IgnoreDetectors) == 0)
101+
contains(i.IgnoreDetectors, detectorName)
102102
}
103103

104104

detector/ignores_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ func TestShouldParseIgnoreLinesProperly(t *testing.T) {
6868
func TestDirectoryPatterns(t *testing.T) {
6969
assertAccepts("foo/", "", "bar", t)
7070
assertAccepts("foo/", "", "foo", t)
71-
assertDenies("foo/", "", "foo/bar", t)
72-
assertDenies("foo/", "", "foo/bar.txt", t)
73-
assertDenies("foo/", "", "foo/bar/baz.txt", t)
71+
assertDenies("foo/", "filename", "foo/bar", t)
72+
assertDenies("foo/", "filename", "foo/bar.txt", t)
73+
assertDenies("foo/", "filename", "foo/bar/baz.txt", t)
7474
}
7575

7676
//Need to work on this test case as it deals with comments and talismanrc does not deal in comments
@@ -91,7 +91,7 @@ func TestIgnoringDetectors(t *testing.T) {
9191
}
9292

9393
func assertDenies(line, ignoreDetector string, path string, t *testing.T) {
94-
assertDeniesDetector(line, ignoreDetector, path, "someDetector", t)
94+
assertDeniesDetector(line, ignoreDetector, path, "filename", t)
9595
}
9696

9797
func assertDeniesDetector(line, ignoreDetector string, path string, detectorName string, t *testing.T) {

0 commit comments

Comments
 (0)