Closed yairogen closed 3 years ago
hey @yairogen I'm looking at how we deal with on our side and our internal projects apply this plugin together with lint.
@CompileStatic
class ScalaPluginCheckPlugin implements Plugin<Project> {
private final String SCALA_ANALYSIS_TASK_PREFIX = 'incrementalScalaAnalysis'
@Override
void apply(Project project) {
project.plugins.withType(ScalaPlugin) {
project.afterEvaluate {
project.configurations.each {
if (it.name.startsWith(SCALA_ANALYSIS_TASK_PREFIX)) {
it.extendsFrom = [] as Iterable<Configuration>
assert !it.extendsFrom
}
}
}
}
}
}
I think the difference could be missing afterEvaluate
in your case. Other differences seem to be related to the fact that it is a statically compiled plugin and that it can be applied before the scala plugin. This should not be a problem if you have the workaround directly in your build file.
Note this not necessarily a lint issue but anything which tries to resolve those configurations would end up with the problem.
@chali Indeed this resolves the issue:
afterEvaluate {
configurations.all {
if (name.startsWith("incrementalScalaAnalysis")) {
extendsFrom = []
}
}
}
However, I don't see any of my sub projects (gradle projects that are pointed by my top level gradle project) are scanned. Do I need to define the plugin in each one?
Also, why are these warnings?
warning unused-dependency one or more classes in commons-io:commons-io:2.4 are required by your code directly (no auto-fix available)
If I use directly - then this is not "unused", no?
I think the rule has a couple of modes that it reports and actually, in this case, it is saying that in your code you consume classes from commons-io
but you don't have a direct dependency on it.
I should add a caveat that those rules are not in the best shape, there is a bunch of issue about false positive and missed dependencies. We, unfortunately, don't have currently bandwidth to focus on them and we are not even using them internally at this moment to avoid those issues.
I am getting the following errors on all my dependencies when running:
gradlew lintGradle
.I tried to add the workaround mentioned in: https://github.com/gradle/gradle/issues/6854 like this and it didn't help:
Note: The following is a sample. I get this for all my dependencies.