SOLVED Hello guys, how are you doing? I updated ...
# detekt
c
SOLVED Hello guys, how are you doing? I updated detekt from 1.21.0 to Latest but I always get this error when trying to run it from CL:
Copy code
* What went wrong:
Execution failed for task ':app:detekt'.
> Run failed with 3 invalid config properties.
        - Property 'formatting' is misspelled or does not exist.
        - Property 'libraries' is misspelled or does not exist.
        - Property 'ruleauthors' is misspelled or does not exist.
This is how detekt is setup here ATM (I created a separate gradle file for it):
Copy code
apply plugin: 'io.gitlab.arturbosch.detekt'

detekt {
    toolVersion = "$detektVersion"
    allRules = true
    autoCorrect = true
    buildUponDefaultConfig = true
    config = files("${rootProject.projectDir}/config/detekt/detekt.yml")
    parallel = true
    source = files(rootProject.projectDir)
    reports {
        xml.required.set(true)
        html.required.set(true)
        txt.required.set(true)
        sarif.required.set(true)
        md.required.set(true)
    }
}
I'm using the latest detekt.yml: https://github.com/detekt/detekt/tree/main/config/detekt I've searched online but couldn't find anything helpful. Any help would be appreciated. Thank you.
g
That is happening as you’re including
formatting
,
libraries
and
ruleauthors
in your config, but you’re not including them with
detektPlugins
so the logic of the rule is missing. Either you remove those keys from your config, or you add 3
detektPlugins
dependencies
c
I see. Searching for it, isn't the detektPlugins's repo archived/not active?
I think I got it: I put this dependency: detektPlugins "io.gitlab.arturbosch.detektdetekt formatting$detektVersion" But when I tried to apply the same logic to the remaining 2:
Copy code
detektPlugins "io.gitlab.arturbosch.detekt:detekt-libraries:$detektVersion"
detektPlugins "io.gitlab.arturbosch.detekt:detekt-ruleauthors:$detektVersion"
I got this error:
Copy code
* What went wrong:
Configuration cache state could not be cached: field `__pluginClasspath__` of task `:app:detekt` of type `io.gitlab.arturbosch.detekt.Detekt`: error writing value of type 'org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection'
> Could not resolve all files for configuration ':app:detektPlugins'.
   > Could not find io.gitlab.arturbosch.detekt:detekt-libraries:1.23.0-RC2.
     Searched in the following locations:
       - <https://dl.google.com/dl/android/maven2/io/gitlab/arturbosch/detekt/detekt-libraries/1.23.0-RC2/detekt-libraries-1.23.0-RC2.pom>
       - <https://repo.maven.apache.org/maven2/io/gitlab/arturbosch/detekt/detekt-libraries/1.23.0-RC2/detekt-libraries-1.23.0-RC2.pom>
     Required by:
         project :app
   > Could not find io.gitlab.arturbosch.detekt:detekt-ruleauthors:1.23.0-RC2.
     Searched in the following locations:
       - <https://dl.google.com/dl/android/maven2/io/gitlab/arturbosch/detekt/detekt-ruleauthors/1.23.0-RC2/detekt-ruleauthors-1.23.0-RC2.pom>
       - <https://repo.maven.apache.org/maven2/io/gitlab/arturbosch/detekt/detekt-ruleauthors/1.23.0-RC2/detekt-ruleauthors-1.23.0-RC2.pom>
     Required by:
         project :app
I'll see if there's some problem related to versioning or something. But thanks for your help pal. At least now it's a different error message 🦜
Got it working guys 🍾 If you have the same error in the future, take a look at this site to check if your dependency naming is correct: https://repo.maven.apache.org/maven2/io/gitlab/arturbosch/detekt/ In my case, those are the correct names: I put at the end of the dependencies{} block "$detektVersion" here is equivalent to "1.23.0-RC2"
Copy code
//detekt Plugins
detektPlugins "io.gitlab.arturbosch.detekt:detekt-formatting:$detektVersion"

detektPlugins "io.gitlab.arturbosch.detekt:detekt-rules-libraries:$detektVersion"

detektPlugins "io.gitlab.arturbosch.detekt:detekt-rules-ruleauthors:$detektVersion"
I could not find this information on the detekt website so maybe in the future the maker of this awesome library may add this info to it. Have a great weekend folks 👍
b
And the link you share is not the last config of detekt. The cli and the gradle plugin have ways to generate a default configuration. That's the way to get the latest config.
That link shows how detekt configures detekt. And this project has a lot of special configurations. I don't think it is a good start point
c
Interesting. Thanks for the info, @Brais Gabin 👍
544 Views