Skip to content

Commit

Permalink
Enable autofix in pre-commit hooks when possible
Browse files Browse the repository at this point in the history
  • Loading branch information
carhartl committed Jul 25, 2023
1 parent c8770ab commit 11dcce3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,17 @@ pre-commit:
prettier:
tags: style glue
glob: "*.{json,md,yaml,yml}"
run: prettier --check {staged_files}
stage_fixed: true
run: prettier --write {staged_files}
shellcheck:
tags: lint shell
glob: "*.{bash,sh}"
run: shellcheck {staged_files}
shfmt:
tags: style shell
glob: "*.{bash,sh}"
run: shfmt -d {staged_files}
stage_fixed: true
run: shfmt -w {staged_files}
yamllint:
tags: lint yaml
glob: "*.{yaml,yml}"
Expand Down
6 changes: 4 additions & 2 deletions terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ pre-commit:
terraform-fmt:
tags: style terraform
glob: "*.{tf,tfvars}"
run: terraform fmt -check -diff {staged_files}
stage_fixed: true
run: terraform fmt -write {staged_files}
tflint:
tags: lint terraform
glob: "*.{tf,tfvars}"
stage_fixed: true
run: |
for file in {staged_files}; do tflint --recursive --filter=$(basename "$file"); done
for file in {staged_files}; do tflint --fix --recursive --filter=$(basename "$file"); done

0 comments on commit 11dcce3

Please sign in to comment.