Formatting problems(CI was not passing)

This commit is contained in:
Dimitar Banchev 2024-08-30 11:50:08 +02:00 committed by Cosmin Cojocar
parent 7f8f654235
commit b4c746962f
3 changed files with 26 additions and 32 deletions

View file

@ -1521,7 +1521,6 @@ var _ = Describe("Analyzer", func() {
Expect(controlIssues[0].Suppressions[0].Justification).To(Equal("Globally suppressed."))
})
It("should not report an error if the analyzer is excluded", func() {
sample := testutils.SampleCodeG407[0]
source := sample.Code[0]

View file

@ -57,8 +57,8 @@ func runHardCodedNonce(pass *analysis.Pass) (interface{}, error) {
"crypto/cipher.NewOFB": {2, 1},
}
var issues []*issue.Issue
var ssaPkgFunctions = ssaResult.SSA.SrcFuncs
var savedArgsFromFunctions = *iterateAndGetArgsFromTrackedFunctions(ssaPkgFunctions, &calls)
ssaPkgFunctions := ssaResult.SSA.SrcFuncs
savedArgsFromFunctions := *iterateAndGetArgsFromTrackedFunctions(ssaPkgFunctions, &calls)
for _, savedArg := range savedArgsFromFunctions {
tmp, err := raiseIssue(savedArg, &calls, ssaPkgFunctions, pass, "")
@ -148,14 +148,12 @@ func raiseIssue(val *ssa.Value, funcsToTrack *map[string][]int, ssaFuncs []*ssa.
// Iterate through all places that use the `variable` argument and check if it's used in one of the tracked functions
func iterateThroughReferrers(variable *ssa.Value, funcsToTrack *map[string][]int, analyzerID string, issueDescription string, fileSet *token.FileSet, issueSeverity issue.Score, issueConfidence issue.Score) ([]*issue.Issue, error) {
if funcsToTrack == nil || variable == nil || analyzerID == "" || issueDescription == "" || fileSet == nil {
return nil, errors.New("received a nil object")
}
var gosecIssues []*issue.Issue = nil
// Go trough all functions that use the given arg variable
for _, referrer := range *(*variable).Referrers() {
// Iterate trough the functions we are interested
for trackedFunc := range *funcsToTrack {

View file

@ -2,10 +2,8 @@ package testutils
import "github.com/securego/gosec/v2"
var (
// SampleCodeG407 - Use of hardcoded nonce/IV
SampleCodeG407 = []CodeSample{
// SampleCodeG407 - Use of hardcoded nonce/IV
var SampleCodeG407 = []CodeSample{
{[]string{`package main
import (
@ -472,5 +470,4 @@ func main() {
}
`}, 1, gosec.NewConfig()},
}
)
}