ansible-lint not triggered during pre-commit hook in Trunk CLI #403
howmuch515
started this conversation in
Bugs
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi Trunk team,
I'm encountering an issue where
ansible-lintdoes not run during the pre-commit hook, even though it works correctly when runningtrunk checkmanually.Setup
Trunk CLI version:
1.22.12trunk.yamlconfiguration:Steps to Reproduce
Set up git hooks:
Introduce a deliberate linting issue by using a short module name:
Run
trunk checkmanually:Output:
Commit the changes:
git commit -am "test"Output:
Observations
The manual
trunk checkcorrectly identifies the linting issue.The pre-commit hook does not detect the same issue.
The pre-commit hook runs the following command:
Running this command manually also fails to detect the issue:
trunk check -n -t "git-commit" --index-file .git/index --upstream=HEADOmitting the
--index-fileflag allows the issue to be detected:trunk check -n -t "git-commit" --upstream=HEADConclusion
It appears that specifying the
--index-fileflag causesansible-lintto skip linting certain files during the pre-commit hook.Is there a recommended way to ensure
ansible-lintruns correctly during pre-commit checks?Any insights or suggestions would be greatly appreciated.
Beta Was this translation helpful? Give feedback.
All reactions