Skip to content

Commit

Permalink
The check for ignoring should use the resource block (#782)
Browse files Browse the repository at this point in the history
  • Loading branch information
owenrumney committed Jun 11, 2021
1 parent 1273691 commit d4ddd6e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/app/tfsec/scanner/scanner.go
Expand Up @@ -85,7 +85,7 @@ func (scanner *Scanner) Scan(blocks []*block.Block) []result.Result {
}

func (scanner *Scanner) checkRangeIgnored(id string, r block.Range, b block.Range) bool {
raw, err := ioutil.ReadFile(r.Filename)
raw, err := ioutil.ReadFile(b.Filename)
if err != nil {
return false
}
Expand All @@ -110,7 +110,7 @@ func (scanner *Scanner) checkRangeIgnored(id string, r block.Range, b block.Rang
}
}

// check the line above the block
// check the line above the actual resource block
if b.StartLine-1 > 0 {
line := lines[b.StartLine-1]
if ignored := checkLineForIgnore(line, ignoreAll, ignoreCode); ignored {
Expand Down

0 comments on commit d4ddd6e

Please sign in to comment.