Skip to content

Commit

Permalink
feat: add a examples field to check metadata
Browse files Browse the repository at this point in the history
Signed-off-by: nikpivkin <nikita.pivkin@smartforce.io>
  • Loading branch information
nikpivkin committed Dec 8, 2024
1 parent ffe24e1 commit 678e7af
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/iac/rego/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type StaticMetadata struct {
Library bool
CloudFormation *scan.EngineMetadata
Terraform *scan.EngineMetadata
Examples string
}

func NewStaticMetadata(pkgPath string, inputOpt InputOptions) *StaticMetadata {
Expand Down Expand Up @@ -75,6 +76,7 @@ func (sm *StaticMetadata) update(meta map[string]any) error {
upd(&sm.Provider, "provider")
upd(&sm.RecommendedActions, "recommended_actions")
upd(&sm.RecommendedActions, "recommended_action")
upd(&sm.Examples, "examples")

if raw, ok := meta["deprecated"]; ok {
if dep, ok := raw.(bool); ok {
Expand Down Expand Up @@ -269,6 +271,7 @@ func (m StaticMetadata) ToRule() scan.Rule {
Frameworks: m.Frameworks,
CloudFormation: m.CloudFormation,
Terraform: m.Terraform,
Examples: m.Examples,
}
}

Expand Down
1 change: 1 addition & 0 deletions pkg/iac/scan/rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ type Rule struct {
Severity severity.Severity `json:"severity"`
Terraform *EngineMetadata `json:"terraform,omitempty"`
CloudFormation *EngineMetadata `json:"cloud_formation,omitempty"`
Examples string `json:"-"`
CustomChecks CustomChecks `json:"-"`
RegoPackage string `json:"-"`
Frameworks map[framework.Framework][]string `json:"frameworks"`
Expand Down

0 comments on commit 678e7af

Please sign in to comment.