[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
Big Chungus
09/02/2020, 9:35 AM
It's git restrictions. Any changes made by precommit hooks will not be included in the commit by design.
👍 1
Big Chungus
09/02/2020, 9:36 AM
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
Javier
09/02/2020, 9:59 AM
@Big Chungus do you know if it is possible to run detekt only on changed files?
b
Big Chungus
09/02/2020, 10:14 AM
No idea, not using it myself, just had simmilar issues with git hooks a while ago on some other projects
👍 1
g
gammax
09/02/2020, 1:08 PM
@Javier you should be able to do that if you use detekt-cli
👍 1
s
schalkms
09/02/2020, 6:52 PM
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).