Documentation ¶
Index ¶
- Constants
- Variables
- func CaptureCommandOutput(cmd *cobra.Command, args []string) (string, error)
- func CaptureOutput(funcToExec execute) (string, error)
- func ChangeCurrentDir(desiredDir string) error
- func GetCurrentDirName(path string) string
- func MapToStringSlice(stringKeyMap map[string]string) []string
- func StringifyStruct(v interface{}) (string, error)
Constants ¶
const (
// ValidUUIDRegex is a constant representing a regular expression rule to validate UUID string
ValidUUIDRegex = `(?i)^[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$`
)
Variables ¶
var ComplexSummaryMock = model.Summary{ Counters: model.Counters{ ScannedFiles: 2, ParsedFiles: 2, FailedToScanFiles: 0, TotalQueries: 2, FailedToExecuteQueries: 0, }, Queries: []model.QueryResult{ queryHigh, queryMedium, }, SeveritySummary: model.SeveritySummary{ ScanID: "console", SeverityCounters: map[model.Severity]int{ model.SeverityInfo: 0, model.SeverityLow: 0, model.SeverityMedium: 1, model.SeverityHigh: 2, }, TotalCounter: 3, }, LatestVersion: model.Version{ Latest: true, }, }
ComplexSummaryMock a summary with more results to be used without running kics scan
var ExampleSummaryMock = model.Summary{ Counters: model.Counters{ ScannedFiles: 2, ParsedFiles: 2, FailedToScanFiles: 0, TotalQueries: 2, FailedToExecuteQueries: 0, }, Queries: []model.QueryResult{ queryInfo, queryMedium2, }, SeveritySummary: model.SeveritySummary{ ScanID: "console", SeverityCounters: map[model.Severity]int{ model.SeverityInfo: 2, model.SeverityLow: 0, model.SeverityMedium: 1, model.SeverityHigh: 0, }, TotalCounter: 3, }, ScannedPaths: []string{ "./", }, }
ExampleSummaryMock a summary with specific results to CycloneDX report tests
var SimpleSummaryMock = model.Summary{ Counters: model.Counters{ ScannedFiles: 1, ParsedFiles: 1, FailedToScanFiles: 0, TotalQueries: 1, FailedToExecuteQueries: 0, }, Queries: []model.QueryResult{ queryMedium, }, SeveritySummary: model.SeveritySummary{ ScanID: "console", SeverityCounters: map[model.Severity]int{ model.SeverityInfo: 0, model.SeverityLow: 0, model.SeverityMedium: 1, model.SeverityHigh: 0, }, TotalCounter: 1, }, ScannedPaths: []string{ "./", }, }
SimpleSummaryMock a summary with specific results to ASFF report tests
var SummaryMock = model.Summary{ Counters: model.Counters{ ScannedFiles: 1, ParsedFiles: 1, FailedToScanFiles: 0, TotalQueries: 1, FailedToExecuteQueries: 0, }, Queries: []model.QueryResult{ queryHigh, }, SeveritySummary: model.SeveritySummary{ ScanID: "console", SeverityCounters: map[model.Severity]int{ model.SeverityInfo: 0, model.SeverityLow: 0, model.SeverityMedium: 0, model.SeverityHigh: 2, }, TotalCounter: 2, }, ScannedPaths: []string{ "./", }, }
SummaryMock a summary to be used without running kics scan
Functions ¶
func CaptureCommandOutput ¶
CaptureCommandOutput set cobra command args, if necessary, then capture the output
func CaptureOutput ¶
CaptureOutput changes default stdout to intercept into a buffer, converts it to string and returns it
func ChangeCurrentDir ¶
ChangeCurrentDir gets current working directory and changes to its parent until finds the desired directory or fail
func GetCurrentDirName ¶
GetCurrentDirName returns current working directory
func MapToStringSlice ¶ added in v1.2.0
MapToStringSlice extract slice of keys from a map[string]string
func StringifyStruct ¶ added in v1.1.3
StringifyStruct stringify struct for pretty print
Types ¶
This section is empty.