[UP] I am having problems with the pre-commit hook...
# detekt
j
[UP] I am having problems with the pre-commit hook. First the changes are commit and after that, I have to commit again to commit the files changed by detekt, anyone is having this issue?
👀 1
b
It's git restrictions. Any changes made by precommit hooks will not be included in the commit by design.
👍 1
You can add postcommit hook that appends those changes to last commit, just make sure to add no-verify flag to avoid infinite loop
👍 1
j
@Big Chungus do you know if it is possible to run detekt only on changed files?
b
No idea, not using it myself, just had simmilar issues with git hooks a while ago on some other projects
👍 1
g
@Javier you should be able to do that if you use detekt-cli
👍 1
s
Be aware that when running detekt only on a small subset of changes you won't be able to use the full analyzer capabilities. Some rules need a broader context (those using type and symbol solving).
👍 2