gruntwork-io / pre-commit

A collection of pre-commit hooks used by Gruntwork tools
https://gruntwork.io/
Apache License 2.0
494 stars 157 forks source link

Update terraform-fmt to match terraform-validate #46

Closed brikis98 closed 3 years ago

brikis98 commented 3 years ago

This PR updates the terraform-fmt hook as follows:

  1. Run with -diff -check so the differences are printed, rather than made on disk.
  2. Instead of exiting on the first error, save the exit codes, and print out all fmt errors before exiting.

These changes are very similar to https://github.com/gruntwork-io/pre-commit/pull/45.

brikis98 commented 3 years ago

Seems to work great! PR updated.

brikis98 commented 3 years ago

Thanks for the review! Merging now.

brikis98 commented 3 years ago

https://github.com/gruntwork-io/pre-commit/releases/tag/v0.1.12

ayk33 commented 3 years ago

What was the reason for adding -check? It was kind of nice having it automatically format the tf code for you instead of someone manually making the changes that need to be made?

L1ghtn1ng commented 3 years ago

What was the reason for adding -check? It was kind of nice having it automatically format the tf code for you instead of someone manually making the changes that need to be made?

I second this as well