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

Javier

03/10/2023, 11:40 AM
Does someone have a custom script or Gradle task to merge detekt reports on the root directory? I had a workaround that was running detekt on the root project over all files, but it is problematic with Gradle 8
s

Sebastian Schuberth

03/10/2023, 12:07 PM
j

Javier

03/10/2023, 12:09 PM
wow, I didn't know that exists, it will not work with project isolation, but it will be better than the workaround I just get working now and it was scaling really... bad
@Sebastian Schuberth it only works with one kind of output, right? is it not possible to merge all types?
it is not working for me
image.png
s

Sebastian Schuberth

03/10/2023, 1:03 PM
I believe it works for most report formats, like SARIF and XML, but not for e.g. MD, see https://github.com/detekt/detekt/issues/5034
j

Javier

03/10/2023, 1:03 PM
I created a reportMerge task for each type of file, the
detekt
dir is created at the root build dir, but there are no files
I will remove md and retry, but looks like I am doing something wrong
image.png
After deleting the md task, it still doesn't work
after moving to finalizedBy and some fixes it works, but sadly it doesn't work with html which is what I was looking for 😞
e

eygraber

03/15/2023, 4:24 PM
Don't the gradle docs recommend not starting to address project isolation yet?
j

Javier

03/15/2023, 4:55 PM
I didn't create an issue because, AFAIK, Detekt is applied to only one project, so there is no cross project configurations which can break project isolation
other different things is that there aren't merged reports and the proposed solutions are not project isolation friendly tho
e

Emil Kantis

03/15/2023, 5:14 PM
I want a multimodule repo to use a single baseline. Because, as far as I can tell, the IntelliJ plug-in only supports a single baseline file. The proposed setup uses cross configuration which I’m not keen on introducing.
j

Javier

03/15/2023, 5:37 PM
But that is not related to project isolation support AFAIK
you can use the same file in all projects as you can access to that file without referencing any project, for example,
rootDir.resolve("my common detekt file")
e

Emil Kantis

03/15/2023, 5:56 PM
Each task to generate baseline overwrites the previous baseline instead of aggregating into it
j

Javier

03/15/2023, 5:57 PM
Ah, right. Then maybe the refactor is more needed, cc @Brais Gabin
b

Brais Gabin

03/16/2023, 9:52 PM
I never used the intellij plugin but, to me, that sounds like a missing feature in it. It should support multiple baselines.
I must say that I like to have each module with their own baselines.
e

Emil Kantis

03/16/2023, 9:56 PM
Would be terrific if the IntelliJ plugin supported wildcard matchers (
**/detekt-baseline.xml
) 🙂
b

Brais Gabin

03/16/2023, 10:01 PM
If you can, open an issue on the plugin repo.
I don't usually follow that repo but I'm sure that any pr on that regard will be more than welcome.
e

Emil Kantis

03/16/2023, 10:02 PM
2 Views