novoda/gradle-static-analysis-plugin

Detekt configuration fails with RC6-4

takecare opened this issue · 9 comments

Breaking changes with detekt/detekt#719. systemOrDefaultProfile() is no longer available.

* Where:
Script '.../gradle-static-analysis-plugin/sample-multi-module/team-props/static-analysis.gradle' line: 36

* What went wrong:
A problem occurred evaluating script.
> Could not find method systemOrDefaultProfile() for arguments [] on DetektExtension(version='latest.release', debug=false, profile='main', ideaExtension=IdeaExtension(path=null, codeStyleScheme=null, inspectionsProfile=null, report=null, mask='*.kt'), profiles=[ProfileExtension(name='main', input=.../gradle-static-analysis-plugin/sample-multi-module/app/src/main/java, config=.../gradle-static-analysis-plugin/sample-multi-module/team-props/detekt-config.yml, configResource=/default-detekt-config.yml, filters=.*test.*,.*/resources/.*,.*/tmp/.*, ruleSets=null, output=.../gradle-static-analysis-plugin/sample-multi-module/app/build/reports/detekt, outputName=null, baseline=null, parallel=false, disableDefaultRuleSets=false)]) of type io.gitlab.arturbosch.detekt.extensions.DetektExtension.

I'm looking into this

It is little bit annoying that detekt just removed the public method although it was never documented.

But overall, we should not just fix this but we should be more flexible around this. If a method or property we expect not found, we should maybe produce a warning and just skip.

Right now, the Gradle configuration fails because of this. Nothing runs.

Yeah, unfortunately the only way we seem to be able to make this work now is by compiling detekt into our plugin which we would rather not do. For now we are not supporting RC6-4 and higher; we're waiting for them to complete their rework of the detekt Gradle plugin (see detekt/detekt#771) and then we'll see how to properly act on this — hopefully it will be trivial then since they're ditching profiles, which are the main issue here

I do not agree since this breaks the whole plugin. Fixing detekt integration is another thing to do once the changes in detekt are finished and released.

But on the other hand, the build crashes on configuration phase. Ideally this should never happen. Failures on tools should be isolated from the rest.

I'm also curious what @mr-archano thinks about this?

@tasomaniac I haven't looked back at this issue, as currently I am not working with Detekt in any of my projects. I tend to agree that the plugin should not break, but I thought that just not enabling Detekt in the plugin extension would be enough as a workaround. Am I missing anything?

@tasomaniac I agree that the plugin should not be crashing — I am really squeezed for time these days so I am not sure how much help I can put in. To be honest, I have been hoping for a quicker transition to the StaticAnalysis task on Detekt's part, but that seems to be taking a very long time. I have pinged there and offered our help to move things forward as I'd really like to avoid doing work now that will be thrown away next week. As soon as we have an answer from them we can then decide whether a hotfix is in order or, if it's almost done on their side, if we can move forward with that instead.

In the meantime, the recommended approach is to stick to RC6-3, or to configure Detekt directly instead of using the SAP until things are fixed for 6-4+

Sure, that sounds reasonable. I was just thinking what we can do to prevent such tool related problems in the future.

We cannot expect people to change configuration back and forth to original.

Hope will be better with other integrations. 👍

This can be closed now. Don't know why my PR didn't automatically closed it.

Closed in #121