Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

engine:chore - update to new engine #923

Merged
merged 1 commit into from
Jan 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.22
github.com/ZupIT/horusec-engine v0.3.6
github.com/ZupIT/horusec-engine v1.0.0
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-20220112180741-5e0467b6c7ce // indirect
golang.org/x/net v0.0.0-20220114011407-0dd24b26b47d // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba // indirect
Expand Down
169 changes: 6 additions & 163 deletions go.sum

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions internal/services/custom_rules/custom_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,14 @@ func (r ruleIDValidator) Validate(value interface{}) error {
return fmt.Errorf("unsupported language %s", r.language)
}

return r.valiteDuplicates(id, rules)
return r.validateDuplicates(id, rules)
}

func (r ruleIDValidator) valiteDuplicates(id string, rules []engine.Rule) error {
func (r ruleIDValidator) validateDuplicates(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