https://kotlinlang.org logo
#detekt
Title
# detekt
g

gammax

04/25/2022, 8:27 PM
Just saw question about "running detekt on a single file" on my notifications. I came here to answer, but the message is gone 😅 Anyway, you can use the
--input
arg. More on this here https://detekt.dev/docs/gettingstarted/git-pre-commit-hook
b

Bruno Pérez Motter

05/03/2022, 12:12 AM
does this also work for the gradle plugin? Any plans on adding it?
g

gammax

05/03/2022, 3:31 AM
Yes it works for the Gradle Plugin as well. Though you have to create your own task probably
👍 1
b

Bruno Pérez Motter

05/03/2022, 9:06 PM
Thanks for the response! May i ask how can i run the gradle detekt plugin with certain input files? I’ve tried
./gradlew detekt --input my_file.kt
but i get
Unknown command-line option ‘--input’.
Though you have to create your own task probably
is there an example??
g

gammax

05/04/2022, 5:53 PM
b

Bruno Pérez Motter

05/04/2022, 5:54 PM
thank you!! 🙌
g

gammax

05/04/2022, 5:54 PM
You can't just
./gradlew detekt --input my_file.kt
though. You'll have to use a property or so.
If you run detekt on a single file, use the CLI
98 Views