Commit a5bd84e
authored
fix: Regression from (at least) v1.99.0 which incorrectly handle
### Description of your changes
Probably introduced in #875 or even earlier.
There were issue that regex in `.pre-commit-hooks.yaml` specified for Python `re` library, but we also used it with `grep -e`. `grep -e` working slightly different than we expect, so I switched to `grep -E` which have less differences with Python `re`. (step 3 below)
Then I found that there is no [required `--exit-code=1`](https://trivy.dev/latest/docs/configuration/others/#exit-code) in `run_hook_on_whole_repo` from hook introduction 2 years ago #606. Fixed it too.
From above, I assume that `pre-commit run -a` for
Fix #908
### How can we test changes
1. Clone https://github.com/pre-commit-terraform/GH-908-reproduce.
2. Run `pre-commit run -a` - you'll see 2 occurrences of same error.
3. (Optional) Change `.pre-commit-config.yaml` to
```yaml
repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: 48525b2
hooks:
- id: terraform_trivy
args:
# https://trivy.dev/latest/docs/configuration/others/#exit-code
# It wasn't set, when it should be set by default in hook. Another issue.
- --args=--exit-code=1
```
and run `pre-commit run -a`
4. Change `.pre-commit-config.yaml` to
```yaml
repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: bafa663
hooks:
- id: terraform_trivy
```
and run `pre-commit run -a`pre-commit run -a, that causes multiply hooks runs. terraform_trivy from its introduction could always be Passed for pre-commit run -a (#909)1 parent 6c84595 commit a5bd84e
3 files changed
+4
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
179 | | - | |
| 179 | + | |
180 | 180 | | |
181 | | - | |
| 181 | + | |
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
190 | | - | |
| 190 | + | |
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
| 68 | + | |
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| |||
0 commit comments