Skip to content

Commit

Permalink
feat: change string to Check
Browse files Browse the repository at this point in the history
  • Loading branch information
afdesk committed Jul 22, 2024
1 parent 13956c6 commit e65c3df
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions pkg/iac/rules/providers.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ type Check struct {
Severity string `json:"severity"`
}

func GetProvidersHierarchy() (providers map[string]map[string][]string) {
func GetProvidersHierarchy() (providers map[string]map[string][]Check) {

registeredRules := GetRegistered()

provs := make(map[string]map[string][]string)
provs := make(map[string]map[string][]Check)

for _, rule := range registeredRules {

Expand All @@ -35,16 +35,20 @@ func GetProvidersHierarchy() (providers map[string]map[string][]string) {
cName := rule.GetRule().AVDID

if _, ok := provs[pName]; !ok {
provs[pName] = make(map[string][]string)
provs[pName] = make(map[string][]Check)
}

if _, ok := provs[pName][sName]; !ok {
provs[pName][sName] = make([]string, 0)
provs[pName][sName] = make([]Check, 0)
}

if _, ok := cNames[cName]; !ok {
cNames[cName] = true
provs[pName][sName] = append(provs[pName][sName], cName)
provs[pName][sName] = append(provs[pName][sName], Check{
Name: cName,
Description: rule.GetRule().Summary,
Severity: string(rule.GetRule().Severity),
})
}
}

Expand Down

0 comments on commit e65c3df

Please sign in to comment.