terraform-fmt updates files, optionally skipped via flags#53
terraform-fmt updates files, optionally skipped via flags#53tyron wants to merge 3 commits intogruntwork-io:masterfrom
Conversation
| for file in "$@"; do | ||
| terraform fmt -diff -check "$file" || FMT_ERROR=$? | ||
| for file in "$FILES"; do | ||
| file=$(dirname "$file") |
There was a problem hiding this comment.
This is required to be able to run the hook outside the repo folder. For example, pre-commit try-repo /path/to/local/hook terraform-fmt would invoke terraform fmt with files relative to that /path/to/local/hook. By providing the entire dirname, we can use the pre-commit tool for local development easily.
|
@brikis98 , @yorinasub17 please let me know if this is OK to be reviewed, or if you'd prefer that we don't revert the default behaviour -- rather just expose the flag to switch to the old one. |
| write_changes=true | ||
| FILES=() | ||
|
|
||
| parse_arguments() { |
There was a problem hiding this comment.
Inspired on shellcheck.sh's version:
pre-commit/hooks/shellcheck.sh
Line 13 in e9250bd
|
Any movement on this? Seems a few folks would like old behavior |
|
Just my 2cents: I thought with 1.1.17 this would have been fixed by now. Because it is not, I will still continue using 0.1.11 for auto format files. |
|
+1 on this change. Printing the diff is not as useful as auto-correcting the styling. |
|
Is there anything what I can do to make that change happen? |
|
If anyone interested that change can be easily tested eg. via: |
|
while this is not complete its better then the current fuctionality |
|
Can we get some traction on this. The previous functionality is much nicer. |
|
Also waiting on this functionality |
|
Would be good to see this functionality |
|
I found this functionality in another repository: |
Restore terraform-fmt behaviour from v0.1.11. Fixes #48.
By default, changes are written back to source files as usual for pre-commit hooks, but can be optionally disabled by providing a
--no-autofixflag to terraform-fmt.