Skip to content

Commit

Permalink
engine:chore - update to new engine
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Cardoso <ian.cardoso@zup.com.br>
  • Loading branch information
iancardosozup committed Jan 13, 2022
1 parent 9245d7d commit bd8a79a
Show file tree
Hide file tree
Showing 28 changed files with 2,088 additions and 1,903 deletions.
1 change: 0 additions & 1 deletion cmd/app/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ horusec start -p="/home/user/projects/my-project"
cobra.OnInitialize(func() {
engine.SetLogLevel(cfg.LogLevel)
})

if err := rootCmd.Execute(); err != nil {
os.Exit(1)
}
Expand Down
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.17

require (
github.com/ZupIT/horusec-devkit v1.0.21
github.com/ZupIT/horusec-engine v0.3.6
github.com/ZupIT/horusec-engine v0.3.7-0.20220112184418-f2d0d1a367f5
github.com/bmatcuk/doublestar/v4 v4.0.2
github.com/briandowns/spinner v1.18.0
github.com/docker/docker v20.10.9+incompatible
Expand Down Expand Up @@ -52,6 +52,7 @@ require (
github.com/morikuni/aec v1.0.0 // indirect
github.com/nxadm/tail v1.4.8 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/panjf2000/ants/v2 v2.4.7 // indirect
github.com/pelletier/go-toml v1.9.4 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
Expand All @@ -62,6 +63,7 @@ require (
github.com/subosito/gotenv v1.2.0 // indirect
golang.org/x/crypto v0.0.0-20211117183948-ae814b36b871 // indirect
golang.org/x/net v0.0.0-20211123203042-d83791d6bcd9 // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
golang.org/x/sys v0.0.0-20211210111614-af8b64212486 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba // indirect
Expand Down
167 changes: 6 additions & 161 deletions go.sum

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions internal/services/custom_rules/custom_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,9 @@ func (r ruleIDValidator) Validate(value interface{}) error {

func (r ruleIDValidator) valiteDuplicates(id string, rules []engine.Rule) error {
for _, rule := range rules {
// Custom rules is converted to text.TextRule, so we only need
// to check duplicates in text.TextRule rules.
if r, ok := rule.(text.TextRule); ok {
// Custom rules is converted to text.Rule, so we only need
// to check duplicates in text.Rule rules.
if r, ok := rule.(*text.Rule); ok {
if r.ID == id {
return fmt.Errorf("duplicate rule id %s", id)
}
Expand Down
6 changes: 3 additions & 3 deletions internal/services/custom_rules/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (s *Service) validateAndParseCustomRule(rule *CustomRule) {
}

s.customRules[rule.Language] = append(
s.customRules[rule.Language], s.parseCustomRuleToTextRule(rule),
s.customRules[rule.Language], s.parseCustomRuleToRule(rule),
)
}

Expand All @@ -102,8 +102,8 @@ func (s *Service) openCustomRulesJSONFile() (customRules []*CustomRule, err erro
return customRules, json.Unmarshal(bytes, &customRules)
}

func (s *Service) parseCustomRuleToTextRule(rule *CustomRule) text.TextRule {
return text.TextRule{
func (s *Service) parseCustomRuleToRule(rule *CustomRule) engine.Rule {
return &text.Rule{
Metadata: engine.Metadata{
ID: rule.ID,
Name: rule.Name,
Expand Down
Loading

0 comments on commit bd8a79a

Please sign in to comment.