Hi, guys. I have a problem when using `--auto-corr...
# detekt
a
Hi, guys. I have a problem when using
--auto-correct
option. When i specify it, the baseline file is ignored. Any thoughts on why this might be occurring?
Copy code
./gradlew detekt                 // respects baseline file
./gradlew detekt --auto-correct  // ignores baseline file
b
What do you mean with "ignored"? Would you want not to autofix the issues inside the baseline? That "feature" is not implemented (and I'm not sure if we would want to implement it).
a
Yes, I’d like to fix only new issues, without those that are inside the baseline file.
Within our team, detekt is set up without enabling auto-correction, yet certain team members prefer utilizing scripts such as husky. This led me to thought whether incorporating
./gradlew detekt --auto-correct
as a pre-commit hook is feasible. However, if this approach does not consider the baseline file, it will not work for us.
b
I imagine that you use
--auto-correct
for the
formatting
rule set. That's a wrapper around ktlint. And as far as I know
ktlint
has its own
baseline
. It's now possible to use it while using
detekt
but maybe you could think to split your formatting and your static analysis (code smells) in two. So you use ktlint (and any of their pluggins, I recommend spotless) for formatting and detekt for code smells.
a
I imagine that you use
--auto-correct
for the
formatting
rule set.
Yeah, this our case) Thanks for suggestion, I’ll consider it.