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-lint
does not run during the pre-commit hook, even though it works correctly when runningtrunk check
manually.Setup
Trunk CLI version:
1.22.12
trunk.yaml
configuration:Steps to Reproduce
Set up git hooks:
Introduce a deliberate linting issue by using a short module name:
Run
trunk check
manually:Output:
Commit the changes:
git commit -am "test"
Output:
Observations
The manual
trunk check
correctly 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=HEAD
Omitting the
--index-file
flag allows the issue to be detected:trunk check -n -t "git-commit" --upstream=HEAD
Conclusion
It appears that specifying the
--index-file
flag causesansible-lint
to skip linting certain files during the pre-commit hook.Is there a recommended way to ensure
ansible-lint
runs correctly during pre-commit checks?Any insights or suggestions would be greatly appreciated.
Beta Was this translation helpful? Give feedback.
All reactions