Skip to content

Commit

Permalink
feat: add a examples field to check metadata (#8068)
Browse files Browse the repository at this point in the history
Signed-off-by: nikpivkin <[email protected]>
  • Loading branch information
nikpivkin authored Jan 17, 2025
1 parent 4f77e01 commit 6d84e0c
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 @@ -40,6 +40,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 @@ -76,6 +77,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 @@ -270,6 +272,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 6d84e0c

Please sign in to comment.