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

mokkun

04/08/2020, 4:19 AM
Need a hand with custom reports on Detekt 🙏 [thread]
Hi, thanks for reading this. I'm trying to set up a custom report with Detekt. I've read the main README of the project and the documentation about extensions: • https://github.com/arturbosch/detekt/blob/master/README.mdhttps://arturbosch.github.io/detekt/extensions.html#let-detekt-know-about-your-extensions
I made a small sample project at https://github.com/mokkun/detekt-json-report-sample to show you how I'm currently setting it up.
When I run
./gradlew detekt
I get all the default reports (TXT, HTML and XML) but the custom report is not written. 😞
If you have the time to look into it and help me find what I am missing I'd appreciate it very much. 🙇‍♂️
a

Artur Bosch

04/11/2020, 6:16 PM
Hey @mokkun, you need to register your report so detekt-core can find it, see https://github.com/detekt/detekt/blob/4e645d50cf511633fb0296c08c480ac52a6a1107/detekt-sample-extensions/src/main/resources/META-INF/services/io.gitlab.arturbosch.detekt.api.OutputReport#L1-L0. All detekt extensions need a
META-INF/services
entry.
m

mokkun

04/14/2020, 7:07 AM
Hi @Artur Bosch, thank you so much for the help, it works now. Somehow the docs for the custom report (https://arturbosch.github.io/detekt/extensions.html#custom-reports) don't mention that and I missed it when checking the samples.
a

Artur Bosch

04/14/2020, 12:08 PM
@mokkun glad it worked out. Would you mind opening a PR improving the extension documentation with this detail?
m

mokkun

04/14/2020, 2:03 PM
Sure thing. Will do it within this week. 👍
6 Views