mirror of
https://github.com/tofuutils/pre-commit-opentofu.git
synced 2025-10-15 17:38:54 +02:00
fix: TFSec outputs the same results multiple times (#237)
This commit is contained in:
parent
3ae5eb00b6
commit
71f7c347c9
2 changed files with 3 additions and 2 deletions
|
|
@ -79,6 +79,7 @@
|
||||||
- id: terraform_tfsec
|
- id: terraform_tfsec
|
||||||
name: Terraform validate with tfsec
|
name: Terraform validate with tfsec
|
||||||
description: Static analysis of Terraform templates to spot potential security issues.
|
description: Static analysis of Terraform templates to spot potential security issues.
|
||||||
|
require_serial: true
|
||||||
entry: terraform_tfsec.sh
|
entry: terraform_tfsec.sh
|
||||||
language: script
|
language: script
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,13 +6,13 @@ main() {
|
||||||
parse_cmdline_ "$@"
|
parse_cmdline_ "$@"
|
||||||
|
|
||||||
# propagate $FILES to custom function
|
# propagate $FILES to custom function
|
||||||
tfsec_ "$ARGS" "$FILES"
|
tfsec_ "$ARGS" "${FILES[*]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
tfsec_() {
|
tfsec_() {
|
||||||
# consume modified files passed from pre-commit so that
|
# consume modified files passed from pre-commit so that
|
||||||
# tfsec runs against only those relevant directories
|
# tfsec runs against only those relevant directories
|
||||||
for file_with_path in $FILES; do
|
for file_with_path in ${FILES[*]}; do
|
||||||
file_with_path="${file_with_path// /__REPLACED__SPACE__}"
|
file_with_path="${file_with_path// /__REPLACED__SPACE__}"
|
||||||
paths[index]=$(dirname "$file_with_path")
|
paths[index]=$(dirname "$file_with_path")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue