Skip to content

Commit 6eddd9a

Browse files
committed
Add -enable-audit cli flag
1 parent a23e670 commit 6eddd9a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cmd/gosec/main.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ var (
8484
// #nosec alternative tag
8585
flagAlternativeNoSec = flag.String("nosec-tag", "", "Set an alternative string for #nosec. Some examples: #dontanalyze, #falsepositive")
8686

87+
// flagEnableAudit enables audit mode
88+
flagEnableAudit = flag.Bool("enable-audit", false, "Enable audit mode")
89+
8790
// output file
8891
flagOutput = flag.String("out", "", "Set output file for results")
8992

@@ -196,6 +199,9 @@ func loadConfig(configFile string) (gosec.Config, error) {
196199
if *flagAlternativeNoSec != "" {
197200
config.SetGlobal(gosec.NoSecAlternative, *flagAlternativeNoSec)
198201
}
202+
if *flagEnableAudit {
203+
config.SetGlobal(gosec.Audit, "true")
204+
}
199205
// set global option IncludeRules ,when flag set or global option IncludeRules is nil
200206
if v, _ := config.GetGlobal(gosec.IncludeRules); *flagRulesInclude != "" || v == "" {
201207
config.SetGlobal(gosec.IncludeRules, *flagRulesInclude)

0 commit comments

Comments
 (0)