@@ -224,11 +224,11 @@ func loadConfig(configFile string) (gosec.Config, error) {
224
224
if * flagEnableAudit {
225
225
config .SetGlobal (gosec .Audit , "true" )
226
226
}
227
- // set global option IncludeRules , when flag set or global option IncludeRules is nil
227
+ // set global option IncludeRules, when flag set or global option IncludeRules is nil
228
228
if v , _ := config .GetGlobal (gosec .IncludeRules ); * flagRulesInclude != "" || v == "" {
229
229
config .SetGlobal (gosec .IncludeRules , * flagRulesInclude )
230
230
}
231
- // set global option ExcludeRules , when flag set or global option IncludeRules is nil
231
+ // set global option ExcludeRules, when flag set or global option ExcludeRules is nil
232
232
if v , _ := config .GetGlobal (gosec .ExcludeRules ); flagRulesExclude .String () != "" || v == "" {
233
233
config .SetGlobal (gosec .ExcludeRules , flagRulesExclude .String ())
234
234
}
@@ -438,12 +438,13 @@ func main() {
438
438
}
439
439
440
440
ruleList := loadRules (includeRules , excludeRules )
441
- if len (ruleList .Rules ) == 0 {
442
- logger .Fatal ("No rules are configured" )
443
- }
444
441
445
442
analyzerList := loadAnalyzers (includeRules , excludeRules )
446
443
444
+ if len (ruleList .Rules ) == 0 && len (analyzerList .Analyzers ) == 0 {
445
+ logger .Fatal ("No rules/analyzers are configured" )
446
+ }
447
+
447
448
// Create the analyzer
448
449
analyzer := gosec .NewAnalyzer (config , * flagScanTests , * flagExcludeGenerated , * flagTrackSuppressions , * flagConcurrency , logger )
449
450
analyzer .LoadRules (ruleList .RulesInfo ())
0 commit comments