From 65b18da711a55d57a7098d91d50c86346d796680 Mon Sep 17 00:00:00 2001 From: Grant Murphy Date: Tue, 9 May 2017 21:26:12 -0700 Subject: [PATCH] Hack to address circular dependency in rulelist --- rules/rulelist.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/rules/rulelist.go b/rules/rulelist.go index fff5cb2..1f1e4df 100644 --- a/rules/rulelist.go +++ b/rules/rulelist.go @@ -15,18 +15,24 @@ package rules import ( - "go/ast" - "github.com/GoASTScanner/gas" ) type RuleDefinition struct { Description string - Create func(c gas.Config) (gas.Rule, []ast.Node) + Create gas.RuleBuilder } 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 func NewRuleFilter(action bool, ruleIDs ...string) RuleFilter {