mirror of
https://github.com/securego/gosec.git
synced 2024-11-05 11:35:51 +00:00
Add -enable-audit cli flag
This commit is contained in:
parent
87fcb9b95b
commit
2f1b81b889
1 changed files with 6 additions and 0 deletions
|
@ -84,6 +84,9 @@ var (
|
|||
// #nosec alternative tag
|
||||
flagAlternativeNoSec = flag.String("nosec-tag", "", "Set an alternative string for #nosec. Some examples: #dontanalyze, #falsepositive")
|
||||
|
||||
// flagEnableAudit enables audit mode
|
||||
flagEnableAudit = flag.Bool("enable-audit", false, "Enable audit mode")
|
||||
|
||||
// output file
|
||||
flagOutput = flag.String("out", "", "Set output file for results")
|
||||
|
||||
|
@ -196,6 +199,9 @@ func loadConfig(configFile string) (gosec.Config, error) {
|
|||
if *flagAlternativeNoSec != "" {
|
||||
config.SetGlobal(gosec.NoSecAlternative, *flagAlternativeNoSec)
|
||||
}
|
||||
if *flagEnableAudit {
|
||||
config.SetGlobal(gosec.Audit, "true")
|
||||
}
|
||||
// set global option IncludeRules ,when flag set or global option IncludeRules is nil
|
||||
if v, _ := config.GetGlobal(gosec.IncludeRules); *flagRulesInclude != "" || v == "" {
|
||||
config.SetGlobal(gosec.IncludeRules, *flagRulesInclude)
|
||||
|
|
Loading…
Reference in a new issue