-
-
Notifications
You must be signed in to change notification settings - Fork 757
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for consolidated report in multi-project setup #1295
Comments
It would however be possible to add support for consolidating the reports if that is a requested feature. Adding "Waiting for Feedback" to see if more requests come in for this. |
Great. Thanks for the quick response. |
This makes sense. This would be a nice improvement, I think. |
Before migrating to RC9, we took advantage of the aggregated report that could be easily published as part of a Jenkins build, similarly to JUnit results or JaCoCo coverage. |
Having one report would indeed be great. |
I have started to do some work on this topic and hope to have something to show for next week. |
a question I have is detekt using gradle's reporting stuff if so than the gradle build dashboard should consolidate things into one dash board I mention it as we can look at the code for that plugin to bootstrap on how to consolidate reports...just thinking out loud as I have the same problem as I am doing clean arch as separate modules deps to my app module |
I think this is a legitimate and important enhancement. We have a project with 300+ modules, so having a single merged report would be great. |
Thanks. The project contains mostly Java modules but only a few Kotlin or mixed Java/Kotlin modules since we just started with Kotlin adoption. Nevertheless, it's still hard to find and read detekt report one by one with so many modules. |
@arturbosch in case you are interested, in our project we have 27 modules completely written in Kotlin, totaling at 37k lines of code, with the biggest modules containing around 5k lines. The time it takes detekt to analyze everything is 77.4 seconds (based on the |
I must say that after migrating to running detekt in each subproject, time to complete the analysis has greatly increased. We have about 30-40 modules and when That's not much, but when I think about how fast it was earlier, I cringe a little. Maybe that's due to reports it prints on each module and having consolidated report would help here (I hope). |
Actually the report printing is like 15ms, the overhead is to start a process and setup the kotlin compiler for each module. So for each module 500-1000ms overhead. @abelhegedus thanks for the info, 77 seconds is really much for 37k :/ |
+1, definitely worth implementing. |
Any update on this? This would simplify CI setup for multi modules application. |
I would really like to have a consolidated report of all sub-projects |
@Mauin, @arturbosch is this issue still waiting for feedback? |
Does this mean that I can remove this from my root-project's
In earlier versions I had to apply detekt to each submodule like that. Can I now return to a single detekt configuration for top-level module only? |
Sure, please see https://github.com/arturbosch/detekt/blob/7de59b954c32d01b69e7f8a85ff8c01bbc174506/build.gradle.kts#L280-L295 |
Great, thank you very much, I will try this! |
I had trouble getting detekt RC16 to run on all of my modules at once. I moved the Here's how i had it configured: //<editor-fold desc="detekt">
def detektVersion = "1.0.0-RC16"
apply plugin: 'io.gitlab.arturbosch.detekt'
detekt {
toolVersion = detektVersion
config = files("$rootProject.projectDir/detekt-config.yml")
baseline = file("$rootProject.projectDir/detekt-baseline.xml")
input = files("**/*.kt") // removing/adding this seems to have no effect
reports {
html {
enabled = true
destination = file("$project.buildDir/reports/detekt.html")
}
xml {
enabled = true
destination = file("$project.buildDir/reports/detekt.xml")
}
}
}
// enable formatting rules
dependencies {
detektPlugins "io.gitlab.arturbosch.detekt:detekt-formatting:$detektVersion"
}
//</editor-fold> @arturbosch I was confused by this section of your example above: include("**/*.kt")
include("**/*.kts")
exclude("**/resources/**")
exclude("**/build/**") the |
@joshfriend we have recently updated the website doc for groovy based gradle build files, please see https://arturbosch.github.io/detekt/groovydsl.html The include and exclude part was also confusing for me after we changed the Detekt task to extend the SourceTask. Gradle supports excluding and including files, so we wanted to be gradle idiomic here. You could query the detekt task via
I hope this helps! |
The thing I discovered that moving Detekt simply reports:
This way it grabs all files recursively and feeds them to detekt. But this has just broken because our project became so big that all the filenames do not fit in limit of allowed command line argument count :) So now I'm back to doing
And analyze time is back to several minutes instead of 2 seconds :( |
ohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh. 🤦♂I think that's related to #1768? I thought I was just an idiot who couldn't figure out how to configure it properly. Here's what finally works for me with RC16, this is from the root //<editor-fold desc="detekt">
apply plugin: 'io.gitlab.arturbosch.detekt'
tasks.withType(io.gitlab.arturbosch.detekt.Detekt) {
config = files("$rootProject.projectDir/detekt-config.yml")
baseline = file("$rootProject.projectDir/detekt-baseline.xml")
input = files(rootProject.projectDir)
include '**/*.kt'
include '**/*.kts'
exclude '**/resources/'
exclude '**/build/'
reports {
html {
enabled = true
destination = file("$rootProject.buildDir/reports/detekt.html")
}
xml {
enabled = true
destination = file("$rootProject.buildDir/reports/detekt.xml")
}
}
}
dependencies {
detektPlugins "io.gitlab.arturbosch.detekt:detekt-formatting:1.0.0-RC16"
}
//</editor-fold> Note that if you try to put the xml report anywhere but |
So you've done what we had:
Be aware that all these files are passed to detekt through command line, and a) this fails on Windows after number of files exceed certain (low) amount b) this will fail even on Linux whenever number of files exceed a (larger) amount.
That's because these settings are ignored when specified in |
@dimsuz Which version of detekt are you using? Is the build on Windows still broken with RC16? I thought #1686 would fix the issue with too many files being passed via cli. |
We use RC16. Although we used But somehow I thought that |
Any updates? What's the current status for 1.4.0? Latest information seems to be about 1.0.0-RC16 |
The current state for this is basically a conversation from slack:
A workaround is documented here: https://arturbosch.github.io/detekt/baseline.html#gradle. We know this is a huge blocker for our users. We put it on the roadmap https://github.com/arturbosch/detekt/projects/4. |
Thanks for the reply! I was asking about consolidated report - to simplify reporting on Jenkins - not about the baseline (which I at the moment don't even use), but #2035 is indeed more important. |
Oh, I just read "consolidated" and instantly thought about the baseline issue. |
@AlexCzar @arturbosch I've written a Gradle task which gathers all reports into one folder. Still, it is not a consolidated report but simplifies life on CI. Also, as an idea, maybe there is a way to combine *.xml reports. |
At my company, we have a solution internally that's based on merging the xml reports, and it works pretty well. High level summary is there's a separate Gradle plugin that is applied by the root project and adds a Not sure I'm able to share or contribute the actual code, but I'd highly recommend a solution that looks something like what I described. |
I have to use several files (each for a module) for now. That's really inconvenient and it would be awesome to see a consolidated HTML report. |
@alexzaitsev We're on it: #3394. A follow up will come up as soon as we have bandwidth |
So now with #3491 available with 1.16.0 we are able to merge the reports. But it is still required/best approach for Android projects to apply and configure the detekt plugin for each module in the |
That's correct. Meanwhile, I believe we need to apply detekt plugin per module, but it does not necessarily need to be |
Hello, |
@alexeiartsimovich |
Based on the recent change highlighted in the change log, I have setup a multi-project by adding
detekt
to the subprojects like:The reports are generated successfully in the sub-projects. What should I do to get a consolidated report of all sub-projects? The earlier suggestions seem to be for the older
profile
based config and does not seem to work with this change.The text was updated successfully, but these errors were encountered: