Skip to content

Commit

Permalink
Fix --include-passed (#798)
Browse files Browse the repository at this point in the history
  • Loading branch information
knqyf263 committed Jun 24, 2021
1 parent 69777d0 commit 26bf9db
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions internal/app/tfsec/scanner/scanner.go
Expand Up @@ -63,8 +63,9 @@ func (scanner *Scanner) Scan(blocks []*block.Block) []result.Result {
if rule.IsRuleRequiredForBlock(r, checkBlock) {
debug.Log("Running rule for %s on %s.%s (%s)...", r.ID, checkBlock.Type(), checkBlock.FullName(), checkBlock.Range().Filename)
ruleResults := rule.CheckRule(r, checkBlock, context)
if scanner.includePassed && ruleResults == nil {
res := result.New(checkBlock).WithRange(checkBlock.Range()).WithStatus(result.Passed).WithSeverity(severity.None)
if scanner.includePassed && ruleResults.All() == nil {
res := result.New(checkBlock).WithRuleID(r.ID).WithDescription(fmt.Sprintf("Resource '%s' passed check: %s", checkBlock.FullName(), r.Documentation.Summary)).
WithRange(checkBlock.Range()).WithStatus(result.Passed).WithSeverity(severity.None)
results = append(results, *res)
} else if ruleResults != nil {
for _, ruleResult := range ruleResults.All() {
Expand Down

0 comments on commit 26bf9db

Please sign in to comment.