Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .golangci.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,10 @@ linters-settings:
# Default: low
confidence: medium

# Concurrency value.
# Default: the number of logical CPUs usable by the current process.
concurrency: 12

# To specify the configuration of rules.
# The configuration of rules is not fully documented by gosec:
# https://github.com/securego/gosec#configuration
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ require (
github.com/ryancurrah/gomodguard v1.2.3
github.com/ryanrolds/sqlclosecheck v0.3.0
github.com/sanposhiho/wastedassign/v2 v2.0.6
github.com/securego/gosec/v2 v2.9.6
github.com/securego/gosec/v2 v2.10.0
github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c
github.com/shirou/gopsutil/v3 v3.22.1
github.com/sirupsen/logrus v1.8.1
Expand Down
12 changes: 7 additions & 5 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 13 additions & 5 deletions pkg/config/linters_settings.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package config

import "github.com/pkg/errors"
import (
"runtime"

"github.com/pkg/errors"
)

var defaultLintersSettings = LintersSettings{
Decorder: DecorderSettings{
Expand Down Expand Up @@ -47,6 +51,9 @@ var defaultLintersSettings = LintersSettings{
LangVersion: "",
ExtraRules: false,
},
Gosec: GoSecSettings{
Concurrency: runtime.NumCPU(),
},
Ifshort: IfshortSettings{
MaxDeclLines: 1,
MaxDeclChars: 30,
Expand Down Expand Up @@ -355,12 +362,13 @@ type GoModGuardSettings struct {
}

type GoSecSettings struct {
Includes []string
Excludes []string
Severity string
Confidence string
Includes []string `mapstructure:"includes"`
Excludes []string `mapstructure:"excludes"`
Severity string `mapstructure:"severity"`
Confidence string `mapstructure:"confidence"`
ExcludeGenerated bool `mapstructure:"exclude-generated"`
Config map[string]interface{} `mapstructure:"config"`
Concurrency int `mapstructure:"concurrency"`
}

type GovetSettings struct {
Expand Down
2 changes: 1 addition & 1 deletion pkg/golinters/gosec.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func NewGosec(settings *config.GoSecSettings) *goanalysis.Linter {
nil,
).WithContextSetter(func(lintCtx *linter.Context) {
analyzer.Run = func(pass *analysis.Pass) (interface{}, error) {
gosecAnalyzer := gosec.NewAnalyzer(gasConfig, true, settings.ExcludeGenerated, false, logger)
gosecAnalyzer := gosec.NewAnalyzer(gasConfig, true, settings.ExcludeGenerated, false, settings.Concurrency, logger)
gosecAnalyzer.LoadRules(ruleDefinitions.RulesInfo())

pkg := &packages.Package{
Expand Down