File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -97,6 +97,11 @@ func (gosec *Analyzer) SetConfig(conf Config) {
97
97
gosec .config = conf
98
98
}
99
99
100
+ // Config returns the current configuration
101
+ func (gosec * Analyzer ) Config () Config {
102
+ return gosec .config
103
+ }
104
+
100
105
// LoadRules instantiates all the rules to be used when analyzing source
101
106
// packages
102
107
func (gosec * Analyzer ) LoadRules (ruleDefinitions map [string ]RuleBuilder ) {
Original file line number Diff line number Diff line change @@ -416,6 +416,22 @@ var _ = Describe("Analyzer", func() {
416
416
Expect (ferr [1 ].Err ).Should (MatchRegexp (`error2` ))
417
417
}
418
418
})
419
+
420
+ It ("should set the config" , func () {
421
+ config := gosec .NewConfig ()
422
+ config ["test" ] = "test"
423
+ analyzer .SetConfig (config )
424
+ found := analyzer .Config ()
425
+ Expect (config ).To (Equal (found ))
426
+ })
427
+
428
+ It ("should reset the analyzer" , func () {
429
+ analyzer .Reset ()
430
+ issues , metrics , errors := analyzer .Report ()
431
+ Expect (issues ).To (BeEmpty ())
432
+ Expect (* metrics ).To (Equal (gosec.Metrics {}))
433
+ Expect (errors ).To (BeEmpty ())
434
+ })
419
435
})
420
436
421
437
Context ("when appending errors" , func () {
You can’t perform that action at this time.
0 commit comments