From 0ce02fc827f55740795983a6a3e62f04630b0b16 Mon Sep 17 00:00:00 2001 From: Dustin Decker Date: Tue, 23 Apr 2024 14:29:38 -0700 Subject: [PATCH] Make connection issues less jarring (#2730) * Make connection issues less jarring * lint * fix lint issue * print just the connection issue in yellow * update terminology --- pkg/detectors/falsepositives.go | 2 -- pkg/output/plain.go | 18 ++++++++---------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/pkg/detectors/falsepositives.go b/pkg/detectors/falsepositives.go index 7559cfe1a..856c4ecf7 100644 --- a/pkg/detectors/falsepositives.go +++ b/pkg/detectors/falsepositives.go @@ -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) { diff --git a/pkg/output/plain.go b/pkg/output/plain.go index 81afc832f..202e44cc4 100644 --- a/pkg/output/plain.go +++ b/pkg/output/plain.go @@ -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)