From c3f7f0938d0b903d6b6064461e6be33f3cc16a78 Mon Sep 17 00:00:00 2001 From: suhasgumma Date: Mon, 28 Nov 2022 19:56:27 +0530 Subject: [PATCH] Handle Invalid Formats --- core/pkg/resultshandling/results.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/pkg/resultshandling/results.go b/core/pkg/resultshandling/results.go index cf84a750..94e3b913 100644 --- a/core/pkg/resultshandling/results.go +++ b/core/pkg/resultshandling/results.go @@ -2,6 +2,7 @@ package resultshandling import ( "encoding/json" + "fmt" logger "github.com/kubescape/go-logger" "github.com/kubescape/go-logger/helpers" @@ -100,6 +101,9 @@ func NewPrinter(printFormat, formatVersion string, verboseMode bool, viewType ca case printer.SARIFFormat: return printerv2.NewSARIFPrinter() default: + if printFormat != printer.PrettyFormat { + logger.L().Error(fmt.Sprintf("Invalid format \"%s\", default format \"pretty-printer\" is applied", printFormat)) + } return printerv2.NewPrettyPrinter(verboseMode, formatVersion, viewType) } }