mirror of
https://github.com/securego/gosec.git
synced 2024-12-25 12:05:52 +00:00
Hack to address circular dependency in rulelist
This commit is contained in:
parent
5160048ba6
commit
65b18da711
1 changed files with 9 additions and 3 deletions
|
@ -15,18 +15,24 @@
|
||||||
package rules
|
package rules
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"go/ast"
|
|
||||||
|
|
||||||
"github.com/GoASTScanner/gas"
|
"github.com/GoASTScanner/gas"
|
||||||
)
|
)
|
||||||
|
|
||||||
type RuleDefinition struct {
|
type RuleDefinition struct {
|
||||||
Description string
|
Description string
|
||||||
Create func(c gas.Config) (gas.Rule, []ast.Node)
|
Create gas.RuleBuilder
|
||||||
}
|
}
|
||||||
|
|
||||||
type RuleList map[string]RuleDefinition
|
type RuleList map[string]RuleDefinition
|
||||||
|
|
||||||
|
func (rl RuleList) Builders() []gas.RuleBuilder {
|
||||||
|
builders := make([]gas.RuleBuilder, 0, len(rl))
|
||||||
|
for _, def := range rl {
|
||||||
|
builders = append(builders, def.Create)
|
||||||
|
}
|
||||||
|
return builders
|
||||||
|
}
|
||||||
|
|
||||||
type RuleFilter func(string) bool
|
type RuleFilter func(string) bool
|
||||||
|
|
||||||
func NewRuleFilter(action bool, ruleIDs ...string) RuleFilter {
|
func NewRuleFilter(action bool, ruleIDs ...string) RuleFilter {
|
||||||
|
|
Loading…
Reference in a new issue