mirror of
https://github.com/kubescape/kubescape.git
synced 2026-02-14 18:09:55 +00:00
fixed more flaky pointers in loops (resultshandling)
Signed-off-by: Frédéric BIDON <fredbi@yahoo.com>
This commit is contained in:
@@ -1,56 +0,0 @@
|
||||
linters-settings:
|
||||
govet:
|
||||
check-shadowing: true
|
||||
maligned:
|
||||
suggest-new: true
|
||||
dupl:
|
||||
threshold: 200
|
||||
goconst:
|
||||
min-len: 3
|
||||
min-occurrences: 2
|
||||
forbidigo:
|
||||
forbid:
|
||||
- ^print.*$
|
||||
- 'fmt\.Print.*'
|
||||
gocognit:
|
||||
min-complexity: 65 # This is super high value. We should gradually lower it to 30-40.
|
||||
|
||||
linters:
|
||||
enable:
|
||||
- gosec
|
||||
disable:
|
||||
- typecheck
|
||||
- errcheck
|
||||
- govet
|
||||
- staticcheck
|
||||
- gosimple
|
||||
- deadcode
|
||||
- gofmt
|
||||
- goimports
|
||||
- bodyclose
|
||||
- dupl
|
||||
#- forbidigo # <- see later
|
||||
- gocognit
|
||||
- gocritic
|
||||
- goimports
|
||||
- nakedret
|
||||
#- nolintlint
|
||||
- revive
|
||||
- stylecheck
|
||||
- unconvert
|
||||
- unparam
|
||||
- maligned
|
||||
- lll
|
||||
- gochecknoinits
|
||||
- gochecknoglobals
|
||||
issues:
|
||||
exclude-rules:
|
||||
- linters:
|
||||
- revive
|
||||
text: "var-naming"
|
||||
- linters:
|
||||
- revive
|
||||
text: "type name will be used as (.+?) by other packages, and that stutters"
|
||||
- linters:
|
||||
- stylecheck
|
||||
text: "ST1003"
|
||||
@@ -319,11 +319,13 @@ func (m *Metrics) setResourcesCounters(
|
||||
resources map[string]workloadinterface.IMetadata,
|
||||
results map[string]resourcesresults.Result) {
|
||||
|
||||
for resourceID, result := range results {
|
||||
for resourceID, toPin := range results {
|
||||
r, ok := resources[resourceID]
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
result := toPin
|
||||
|
||||
passed, excluded, failed := resourceControlStatusCounters(&result)
|
||||
|
||||
mrc := mResources{}
|
||||
@@ -339,5 +341,4 @@ func (m *Metrics) setResourcesCounters(
|
||||
|
||||
m.listResources = append(m.listResources, mrc)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -129,7 +129,9 @@ func (sp *SARIFPrinter) ActionPrint(opaSessionObj *cautils.OPASessionObj) {
|
||||
logger.L().Debug("failed to create location resolver", helpers.Error(err))
|
||||
}
|
||||
|
||||
for _, ac := range result.AssociatedControls {
|
||||
for _, toPin := range result.AssociatedControls {
|
||||
ac := toPin
|
||||
|
||||
if ac.GetStatus(nil).IsFailed() {
|
||||
ctl := opaSessionObj.Report.SummaryDetails.Controls.GetControl(reportsummary.EControlCriteriaID, ac.GetID())
|
||||
location := sp.resolveFixLocation(opaSessionObj, locationResolver, &ac, resourceID)
|
||||
|
||||
Reference in New Issue
Block a user