Skip to content

Commit

Permalink
Solve GoReport card issues Closes #2298
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaela-soares committed Apr 12, 2021
1 parent 3d8a6cc commit 00536a8
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion internal/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const Fullname = "Keeping Infrastructure as Code Secure"
// SCMCommit - Source control management commit identifier
const SCMCommit = "N/A"

// LogFile - logfile name
// DefaultLogFile - logfile name
const DefaultLogFile = "info.log"

// DefaultConfigFilename - default configuration filename
Expand Down
3 changes: 1 addition & 2 deletions pkg/detector/default_detect.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ func (d defaultDetectLine) DetectLine(file *model.FileMetadata, searchKey string
lines := strings.Split(text, "\n")
foundAtLeastOne := false
currentLine := 0
isBreak := false
var extractedString [][]string
extractedString = GetBracketValues(searchKey, extractedString, "")
sanitizedSubstring := searchKey
Expand All @@ -32,7 +31,7 @@ func (d defaultDetectLine) DetectLine(file *model.FileMetadata, searchKey string

for _, key := range strings.Split(sanitizedSubstring, ".") {
substr1, substr2 := GenerateSubstrings(key, extractedString)

var isBreak bool
foundAtLeastOne, currentLine, isBreak = DetectCurrentLine(lines, substr1, substr2, currentLine, foundAtLeastOne)

if isBreak {
Expand Down
3 changes: 1 addition & 2 deletions pkg/detector/docker/docker_detect.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ func (d DetectKindLine) DetectLine(file *model.FileMetadata, searchKey string,
logWithFields *zerolog.Logger, outputLines int) model.VulnerabilityLines {
text := strings.ReplaceAll(file.OriginalData, "\r", "")
lines := prepareDockerFileLines(text)
isBreak := false
foundAtLeastOne := false
currentLine := 0
var extractedString [][]string
Expand All @@ -39,7 +38,7 @@ func (d DetectKindLine) DetectLine(file *model.FileMetadata, searchKey string,

for _, key := range strings.Split(sKey, ".") {
substr1, substr2 := detector.GenerateSubstrings(key, extractedString)

var isBreak bool
foundAtLeastOne, currentLine, isBreak = detector.DetectCurrentLine(lines, substr1, substr2,
currentLine, foundAtLeastOne)

Expand Down
2 changes: 1 addition & 1 deletion pkg/engine/source/source.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:generate go run -mod=mod github.com/golang/mock/mockgen -package mock -source=./$GOFILE -destination=../mock/$GOFILE
// Package source (go:generate go run -mod=mod github.com/golang/mock/mockgen -package mock -source=./$GOFILE -destination=../mock/$GOFILE)
package source

import "github.com/Checkmarx/kics/pkg/model"
Expand Down
6 changes: 3 additions & 3 deletions pkg/model/model.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:generate go run -mod=mod github.com/mailru/easyjson/easyjson ./$GOFILE
// Package model (go:generate go run -mod=mod github.com/mailru/easyjson/easyjson ./$GOFILE)
package model

import (
Expand Down Expand Up @@ -180,12 +180,12 @@ func (m FileMetadatas) ToMap() map[string]FileMetadata {
return c
}

//easyjson:json
// Documents (easyjson:json)
type Documents struct {
Documents []Document `json:"document"`
}

//easyjson:json
// Document (easyjson:json)
type Document map[string]interface{}

// Combine merge documents from FileMetadatas using the ID as reference for Document ID and FileName as reference for file
Expand Down
6 changes: 6 additions & 0 deletions pkg/resolver/helm/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,15 @@ func newClient() *action.Install {
func setID(chartReq *chart.Chart) *chart.Chart {
for _, temp := range chartReq.Templates {
temp = addID(temp) //nolint
if temp != nil {
continue
}
}
for _, dep := range chartReq.Dependencies() {
dep = setID(dep) //nolint
if dep != nil {
continue
}
}
return chartReq
}
Expand Down
2 changes: 1 addition & 1 deletion tools/tools.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build tools
// Package tools (+build tools)
package tools

// Manage tool dependencies via go.mod.
Expand Down

0 comments on commit 00536a8

Please sign in to comment.