Make connection issues less jarring (#2730)

* Make connection issues less jarring

* lint

* fix lint issue

* print just the connection issue in yellow

* update terminology
This commit is contained in:
Dustin Decker 2024-04-23 14:29:38 -07:00 committed by GitHub
parent f03aa38726
commit 0ce02fc827
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 12 deletions

View file

@ -139,7 +139,6 @@ func FilterKnownFalsePositives(ctx context.Context, results []Result, falsePosit
switch result.DetectorType {
case detectorspb.DetectorType_CustomRegex:
filteredResults = append(filteredResults, result)
break
case detectorspb.DetectorType_GCP,
detectorspb.DetectorType_URI,
detectorspb.DetectorType_AzureBatch,
@ -149,7 +148,6 @@ func FilterKnownFalsePositives(ctx context.Context, results []Result, falsePosit
detectorspb.DetectorType_MongoDB,
detectorspb.DetectorType_JDBC:
filteredResults = append(filteredResults, result)
break
default:
if result.Raw != nil {
if !IsKnownFalsePositive(string(result.Raw), falsePositives, wordCheck) {

View file

@ -17,12 +17,11 @@ import (
)
var (
boldYellowPrinter = color.New(color.Bold, color.FgYellow)
yellowPrinter = color.New(color.FgHiYellow)
greenPrinter = color.New(color.FgHiGreen)
boldGreenPrinter = color.New(color.Bold, color.FgHiGreen)
whitePrinter = color.New(color.FgWhite)
boldWhitePrinter = color.New(color.Bold, color.FgWhite)
yellowPrinter = color.New(color.FgYellow)
greenPrinter = color.New(color.FgHiGreen)
boldGreenPrinter = color.New(color.Bold, color.FgHiGreen)
whitePrinter = color.New(color.FgWhite)
boldWhitePrinter = color.New(color.Bold, color.FgWhite)
)
// PlainPrinter is a printer that prints results in plain text format.
@ -49,13 +48,12 @@ func (p *PlainPrinter) Print(_ context.Context, r *detectors.ResultWithMetadata)
if out.Verified {
boldGreenPrinter.Print("✅ Found verified result 🐷🔑\n")
} else if out.VerificationError != nil {
printer = yellowPrinter
boldYellowPrinter.Print("⚠️ Found result - unable to verify due to error 🐷🔑❗️\n")
printer.Printf("Verification Error: %s\n", out.VerificationError)
} else {
printer = whitePrinter
boldWhitePrinter.Print("Found unverified result 🐷🔑❓\n")
if out.VerificationError != nil {
yellowPrinter.Printf("Verification issue: %s\n", out.VerificationError)
}
}
printer.Printf("Detector Type: %s\n", out.DetectorType)
printer.Printf("Decoder Type: %s\n", out.DecoderType)