Skip to content

Commit

Permalink
Fix typo by replacing 'Expected file to not to' as 'Expected file to …
Browse files Browse the repository at this point in the history
…not' for improved readibility
  • Loading branch information
muzakh authored and harinee committed Dec 29, 2023
1 parent 4004bbe commit 8201481
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ Talisman Report:
| | failed checks against the |
| | pattern ^.+\.pem$ |
+-----------------+-------------------------------------------------------------------------------+
| danger.pem | Expected file to not to contain hex encoded texts such as: |
| danger.pem | Expected file to not contain hex encoded texts such as: |
| | awsSecretKey=c64e8c79aacf5ddb02f1274db2d973f363f4f553ab1692d8d203b4cc09692f79 |
+-----------------+-------------------------------------------------------------------------------+
```
Expand Down
6 changes: 3 additions & 3 deletions detector/filecontent/base64_aggressive_detector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestShouldFlagPotentialAWSAccessKeysInAggressiveMode(t *testing.T) {
results,
dummyCompletionCallbackFunc)

assert.True(t, results.HasFailures(), "Expected file to not to contain base64 encoded texts")
assert.True(t, results.HasFailures(), "Expected file to not contain base64 encoded texts")
}

func TestShouldFlagPotentialAWSAccessKeysAtPropertyDefinitionInAggressiveMode(t *testing.T) {
Expand All @@ -46,7 +46,7 @@ func TestShouldFlagPotentialAWSAccessKeysAtPropertyDefinitionInAggressiveMode(t
results,
dummyCompletionCallbackFunc)

assert.True(t, results.HasFailures(), "Expected file to not to contain base64 encoded texts")
assert.True(t, results.HasFailures(), "Expected file to not contain base64 encoded texts")
}

func TestShouldNotFlagPotentialSecretsWithinSafeJavaCodeEvenInAggressiveMode(t *testing.T) {
Expand All @@ -68,5 +68,5 @@ func TestShouldNotFlagPotentialSecretsWithinSafeJavaCodeEvenInAggressiveMode(t *
results,
dummyCompletionCallbackFunc)

assert.False(t, results.HasFailures(), "Expected file to not to contain base64 encoded texts")
assert.False(t, results.HasFailures(), "Expected file to not contain base64 encoded texts")
}
6 changes: 3 additions & 3 deletions detector/filecontent/filecontent_detector.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ func (ct contentType) getInfo() string {
func (ct contentType) getMessageFormat() string {
switch ct {
case base64Content:
return "Expected file to not to contain base64 encoded texts such as: %s"
return "Expected file to not contain base64 encoded texts such as: %s"
case hexContent:
return "Expected file to not to contain hex encoded texts such as: %s"
return "Expected file to not contain hex encoded texts such as: %s"
case creditCardContent:
return "Expected file to not to contain credit card numbers such as: %s"
return "Expected file to not contain credit card numbers such as: %s"
}

return ""
Expand Down
34 changes: 17 additions & 17 deletions detector/filecontent/filecontent_detector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestShouldNotFlagSafeText(t *testing.T) {

NewFileContentDetector(emptyTalismanRC).
Test(defaultChecksumCompareUtility, additions, emptyTalismanRC, results, dummyCallback)
assert.False(t, results.HasFailures(), "Expected file to not to contain base64 encoded texts")
assert.False(t, results.HasFailures(), "Expected file to not contain base64 encoded texts")
}

func TestShouldIgnoreFileIfNeeded(t *testing.T) {
Expand Down Expand Up @@ -63,7 +63,7 @@ func TestShouldNotFlag4CharSafeText(t *testing.T) {

NewFileContentDetector(emptyTalismanRC).
Test(defaultChecksumCompareUtility, additions, emptyTalismanRC, results, dummyCallback)
assert.False(t, results.HasFailures(), "Expected file to not to contain base64 encoded texts")
assert.False(t, results.HasFailures(), "Expected file to not contain base64 encoded texts")
}

func TestShouldNotFlagLowEntropyBase64Text(t *testing.T) {
Expand All @@ -74,7 +74,7 @@ func TestShouldNotFlagLowEntropyBase64Text(t *testing.T) {

NewFileContentDetector(emptyTalismanRC).
Test(defaultChecksumCompareUtility, additions, emptyTalismanRC, results, dummyCallback)
assert.False(t, results.HasFailures(), "Expected file to not to contain base64 encoded texts")
assert.False(t, results.HasFailures(), "Expected file to not contain base64 encoded texts")
}

func TestShouldFlagPotentialAWSSecretKeys(t *testing.T) {
Expand All @@ -87,8 +87,8 @@ func TestShouldFlagPotentialAWSSecretKeys(t *testing.T) {
Test(defaultChecksumCompareUtility, additions, emptyTalismanRC, results, dummyCallback)

expectedMessage := fmt.
Sprintf("Expected file to not to contain base64 encoded texts such as: %s", awsSecretAccessKey)
assert.True(t, results.HasFailures(), "Expected file to not to contain base64 encoded texts")
Sprintf("Expected file to not contain base64 encoded texts such as: %s", awsSecretAccessKey)
assert.True(t, results.HasFailures(), "Expected file to not contain base64 encoded texts")
assert.Equal(t, expectedMessage, getFailureMessages(results, filePath)[0])
assert.Len(t, results.Results, 1)
}
Expand All @@ -102,8 +102,8 @@ func TestShouldFlagPotentialSecretWithoutTrimmingWhenLengthLessThan50Characters(
NewFileContentDetector(emptyTalismanRC).
Test(defaultChecksumCompareUtility, additions, emptyTalismanRC, results, dummyCallback)

expectedMessage := fmt.Sprintf("Expected file to not to contain base64 encoded texts such as: %s", secret)
assert.True(t, results.HasFailures(), "Expected file to not to contain base64 encoded texts")
expectedMessage := fmt.Sprintf("Expected file to not contain base64 encoded texts such as: %s", secret)
assert.True(t, results.HasFailures(), "Expected file to not contain base64 encoded texts")
assert.Equal(t, expectedMessage, getFailureMessages(results, filePath)[0])
assert.Len(t, results.Results, 1)
}
Expand All @@ -120,8 +120,8 @@ func TestShouldFlagPotentialJWT(t *testing.T) {
Test(defaultChecksumCompareUtility, additions, emptyTalismanRC, results, dummyCallback)

expectedMessage := fmt.
Sprintf("Expected file to not to contain base64 encoded texts such as: %s", jwt[:47]+"...")
assert.True(t, results.HasFailures(), "Expected file to not to contain base64 encoded texts")
Sprintf("Expected file to not contain base64 encoded texts such as: %s", jwt[:47]+"...")
assert.True(t, results.HasFailures(), "Expected file to not contain base64 encoded texts")
assert.Equal(t, expectedMessage, getFailureMessages(results, filePath)[0])
assert.Len(t, results.Results, 1)
}
Expand All @@ -141,9 +141,9 @@ func TestShouldFlagPotentialSecretsWithinJavaCode(t *testing.T) {

NewFileContentDetector(emptyTalismanRC).
Test(defaultChecksumCompareUtility, additions, emptyTalismanRC, results, dummyCallback)
expectedMessage := "Expected file to not to contain base64 encoded texts such as: " +
expectedMessage := "Expected file to not contain base64 encoded texts such as: " +
"accessKey=\"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPL..."
assert.True(t, results.HasFailures(), "Expected file to not to contain base64 encoded texts")
assert.True(t, results.HasFailures(), "Expected file to not contain base64 encoded texts")
assert.Equal(t, expectedMessage, getFailureMessages(results, filePath)[0])
assert.Len(t, results.Results, 1)
}
Expand All @@ -160,7 +160,7 @@ func TestShouldNotFlagPotentialSecretsWithinSafeJavaCode(t *testing.T) {

NewFileContentDetector(emptyTalismanRC).
Test(defaultChecksumCompareUtility, additions, emptyTalismanRC, results, dummyCallback)
assert.False(t, results.HasFailures(), "Expected file to not to contain base64 encoded texts")
assert.False(t, results.HasFailures(), "Expected file to not contain base64 encoded texts")
}

func TestShouldNotFlagPotentialSecretsWithinSafeLongMethodName(t *testing.T) {
Expand All @@ -170,7 +170,7 @@ func TestShouldNotFlagPotentialSecretsWithinSafeLongMethodName(t *testing.T) {

NewFileContentDetector(emptyTalismanRC).
Test(defaultChecksumCompareUtility, additions, emptyTalismanRC, results, dummyCallback)
assert.False(t, results.HasFailures(), "Expected file to not to contain base64 encoded texts")
assert.False(t, results.HasFailures(), "Expected file to not contain base64 encoded texts")
}

func TestShouldFlagPotentialSecretsEncodedInHex(t *testing.T) {
Expand All @@ -181,7 +181,7 @@ func TestShouldFlagPotentialSecretsEncodedInHex(t *testing.T) {

NewFileContentDetector(emptyTalismanRC).
Test(defaultChecksumCompareUtility, additions, emptyTalismanRC, results, dummyCallback)
expectedMessage := "Expected file to not to contain hex encoded texts such as: " + hex
expectedMessage := "Expected file to not contain hex encoded texts such as: " + hex
assert.Equal(t, expectedMessage, getFailureMessages(results, filePath)[0])
assert.Len(t, results.Results, 1)
}
Expand Down Expand Up @@ -243,7 +243,7 @@ func TestResultsShouldContainHexTextsIfHexAndBase64ExistInFile(t *testing.T) {

NewFileContentDetector(emptyTalismanRC).
Test(defaultChecksumCompareUtility, additions, emptyTalismanRC, results, dummyCallback)
expectedMessage := "Expected file to not to contain hex encoded texts such as: " + hex
expectedMessage := "Expected file to not contain hex encoded texts such as: " + hex
messageReceived := strings.Join(getFailureMessages(results, filePath), " ")
assert.Regexp(t, expectedMessage, messageReceived, "Should contain hex detection message")
assert.Len(t, results.Results, 1)
Expand All @@ -260,7 +260,7 @@ func TestResultsShouldContainBase64TextsIfHexAndBase64ExistInFile(t *testing.T)
NewFileContentDetector(emptyTalismanRC).
Test(defaultChecksumCompareUtility, additions, emptyTalismanRC, results, dummyCallback)

expectedMessage := "Expected file to not to contain base64 encoded texts such as: " + base64
expectedMessage := "Expected file to not contain base64 encoded texts such as: " + base64
messageReceived := strings.Join(getFailureMessages(results, filePath), " ")
assert.Regexp(t, expectedMessage, messageReceived, "Should contain base64 detection message")
assert.Len(t, results.Results, 1)
Expand All @@ -275,7 +275,7 @@ func TestResultsShouldContainCreditCardNumberIfCreditCardNumberExistInFile(t *te
NewFileContentDetector(emptyTalismanRC).
Test(defaultChecksumCompareUtility, additions, emptyTalismanRC, results, dummyCallback)

expectedMessage := "Expected file to not to contain credit card numbers such as: " + creditCardNumber
expectedMessage := "Expected file to not contain credit card numbers such as: " + creditCardNumber
assert.Equal(t, expectedMessage, getFailureMessages(results, filePath)[0])
assert.Len(t, results.Results, 1)
}
Expand Down
4 changes: 2 additions & 2 deletions detector/filesize/filesize_detector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestShouldNotFlagLargeFilesIfThresholdIsBelowSeverity(t *testing.T) {
talismanRCWithThreshold := &talismanrc.TalismanRC{Threshold: severity.High}
additions := []gitrepo.Addition{gitrepo.NewAddition("filename", content)}
NewFileSizeDetector(2).Test(helpers.NewChecksumCompare(nil, defaultHasher, talismanRCWithThreshold), additions, talismanRCWithThreshold, results, func() {})
assert.False(t, results.HasFailures(), "Expected file to not to fail the check against file size detector.")
assert.False(t, results.HasFailures(), "Expected file to not fail the check against file size detector.")
assert.True(t, results.HasWarnings(), "Expected file to have warnings against file size detector.")
}

Expand All @@ -38,7 +38,7 @@ func TestShouldNotFlagSmallFiles(t *testing.T) {
content := []byte("m")
additions := []gitrepo.Addition{gitrepo.NewAddition("filename", content)}
NewFileSizeDetector(2).Test(helpers.NewChecksumCompare(nil, defaultHasher, talismanRC), additions, talismanRC, results, func() {})
assert.False(t, results.HasFailures(), "Expected file to not to fail the check against file size detector.")
assert.False(t, results.HasFailures(), "Expected file to not fail the check against file size detector.")
}

func TestShouldNotFlagIgnoredLargeFiles(t *testing.T) {
Expand Down

0 comments on commit 8201481

Please sign in to comment.