docs: Add terraform_fmt usage instructions and how-to debug script with args (#242)

This commit is contained in:
Maksym Vlasov 2021-10-14 16:25:45 +03:00 committed by GitHub
commit 8a6e4bf4e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 55 additions and 40 deletions

View file

@ -28,6 +28,14 @@ pre-commit try-repo -a ~/pre-commit-terraform # run all existing checks from rep
Running `pre-commit` with `try-repo` ignores all arguments specified in `.pre-commit-config.yaml`.
If you need to test hook with arguments, follow [pre-commit doc](https://pre-commit.com/#arguments-pattern-in-hooks) to test hooks.
For example, to test that the [`terraform_fmt`](../README.md#terraform_fmt) hook works fine with arguments:
```bash
/tmp/pre-commit-terraform/terraform_fmt.sh --args=-diff --args=-write=false test-dir/main.tf test-dir/vars.tf
```
## Run hook performance test
To check is your improvement not violate performance, we have dummy execution time tests.