Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid option terraform_fmt.sh #207

Closed
nadworny opened this issue Jun 25, 2021 · 1 comment · Fixed by #221
Closed

Invalid option terraform_fmt.sh #207

nadworny opened this issue Jun 25, 2021 · 1 comment · Fixed by #221
Labels
estimate/1h Need 1 hour to be done hook/terraform_fmt Bash hook

Comments

@nadworny
Copy link

Problem

During pre-commit run -a I'm getting the following error:

Terraform fmt............................................................Failed
- hook id: terraform_fmt
- exit code: 2

: invalid optionadworny/.cache/pre-commit/repot5f0ochh/terraform_fmt.sh: line 2: set: -
set: usage: set [--abefhkmnptuvxBCHP] [-o option] [arg ...]

My .pre-commit-config.yml:

exclude: '(^.+\.log$)'
repos:
  -  repo: https://github.com/antonbabenko/pre-commit-terraform
     rev: v1.50.0
     hooks:
       -  id: terraform_fmt

Workaround

It seems to be somehow related to the new lines problem as after executing dos2unix terraform_fmt.sh everything works fine (see https://askubuntu.com/questions/1044280/set-eo-pipefail-not-working-in-windows-subsystem-for-linux-ubuntu-16-04 and #204)

Environment

image
GNU bash, version 5.1.8(1)-release (x86_64-apple-darwin20.3.0)
pre-commit 2.13.0

@MaxymVlasov
Copy link
Collaborator

Interesting, because the error does not exist in the repo

22:49 pre-commit-terraform git:(tags/v1.50.0 $!?) on 🐳 v20.10.7 
✘1 ➜ pre-commit run -a mixed-line-ending

Mixed line ending........................................................Passed

But for sure, I will add a pre-commit check for that issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
estimate/1h Need 1 hour to be done hook/terraform_fmt Bash hook
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants