nebula-plugins / gradle-lint-plugin

A pluggable and configurable linter tool for identifying and reporting on patterns of misuse or deprecations in Gradle scripts.
Apache License 2.0
771 stars 89 forks source link

No such property: code for class: org.codehaus.groovy.ast.expr.PropertyExpression #406

Open boris-petrov opened 6 months ago

boris-petrov commented 6 months ago

After adding some specific code to my project, gradle autoLintGradle began failing with:

Error from [com.netflix.nebula.lint.rule.GradleLintRule$1] processing source file [null]
groovy.lang.MissingPropertyException: No such property: code for class: org.codehaus.groovy.ast.expr.PropertyExpression
Possible solutions: safe, type
        at com.netflix.nebula.lint.rule.dependency.DeprecatedDependencyConfigurationRule.handleProjectDependencies(DeprecatedDependencyConfigurationRule.groovy:61)
        at com.netflix.nebula.lint.rule.dependency.DeprecatedDependencyConfigurationRule.visitDependencies(DeprecatedDependencyConfigurationRule.groovy:51)
        at com.netflix.nebula.lint.rule.dependency.DeprecatedDependencyConfigurationRule$visitDependencies.call(UnknownSource)
        at com.netflix.nebula.lint.rule.GradleLintRule$1$1.visitMethodCallExpression(GradleLintRule.groovy:270)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
        at org.gradle.internal.classpath.CallInterceptingMetaClass.lambda$invokeMethod$5(CallInterceptingMetaClass.java:179)
        at org.gradle.internal.classpath.CallInterceptingMetaClass.invokeIntercepted(CallInterceptingMetaClass.java:235)
        at org.gradle.internal.classpath.CallInterceptingMetaClass.invokeMethod(CallInterceptingMetaClass.java:179)
        at com.netflix.nebula.lint.rule.CompositeGroovyAstVisitor$_visitMethodCallExpression_closure31.doCall$original(CompositeGroovyAstVisitor.groovy:225)
        at com.netflix.nebula.lint.rule.CompositeGroovyAstVisitor$_visitMethodCallExpression_closure31.doCall(CompositeGroovyAstVisitor.groovy)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
        at com.netflix.nebula.lint.rule.CompositeGroovyAstVisitor.visitMethodCallExpression(CompositeGroovyAstVisitor.groovy:225)
        ...

The code in question that does this is:

configurations {
    myConfiguration
}

tasks.register('myTask', JRubyPrepare) {
    dependencies configurations.myConfiguration
}

The JRubyPrepare task comes from jruby-gradle-plugin but I don't think that matters.