Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit lost 😕 How this differs from
tflint "${ARGS[@]}" 2>/dev/null
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it evaluate
$(…)
and then redirects its stderr to /dev/null and this helps to properly fail the hook?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha...
You can try it by yourself. https://github.com/antonbabenko/pre-commit-terraform/blob/master/.github/CONTRIBUTING.md#run-and-debug-hooks-locally
No idea why it works as it works
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm-m, it works for me both ways. Skipping the
$(tflint "${ARGS[@]}" 2>&1) 2> /dev/null || {
item, here's what I get withtflint "${ARGS[@]}" 2>/dev/null 2>&1 || {
:Also here's the other approach which eliminates second
tflint
exec:Both fail as expected whereas second approach looks to be more optimized in my opinion.
Thanks for being patient and explaining all the caveats to me 🙇
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, the
tflint "${ARGS[@]}" 2>/dev/null 2>&1 || {
should obviously betflint "${ARGS[@]}" >/dev/null 2>&1 || {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant pre-commit tflint hook config
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be keen to take a look into this bash thing but I don't have respective pro-commit configuration to mimic your setup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's either I'm dumb with this or the time is late, but I can't get how do you configure tflint pre-commit hook to recurse into subdirs so that it throws errors like
ERROR in environment/prd/:
😕I most probably am missing something very simple, but — my bad — I don't get it 🤦
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pre-commit run -a
or --all