Closed ege-ah closed 2 years ago
This means your rule is not properly brought on the module detekt wants to be running on. Make sure your gradle setup is correct and the rule is being applied in the right place.
Namely, this means that your step 1 is not correctly done (e.g. not done in the right place, at all necessary times).
For example, this happened to me when I was applying the detekt gradle plugin to modules but the detektPlugins was not applied to exactly the same modules the gradle plugin was being applied to.
How come detekt is working properly and CI doesnt fail without this plugin?
This is a custom plugin that has configuration to be added in detekt.yml. If the detekt gradle plugin is running through a module and finds this in detekt.yml, without seeing a plugin that can handle it, that's when you see this error. It's a mechanism Detekt has to detect misconfigurations in the build when using custom plugins.
It means that there is at least 1 place (maybe more, but at least 1) where detekt sees your config but doesn't have detektPlugins("com.twitter.compose.rules:detekt:$twitterComposeVersion")
and it needs it.
From what you pasted here I cannot tell you exactly where it's wrong, but the error you are seeing is because of what I mentioned 😅
thanks for the response but still cannot understand why detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:$detektVersion")
works but not twittterCompose plugin, they are both in detekt.gradle which is applied in build.gradle (app)
As it's a rule they themselves maintain, the tooling provided out of the box contains generating the formatting defaults, so the proper config should already be there everywhere it's necessary (at least it used to anyway). They also include a default value in their resources/ (which I guess it's something we could do as well if it's open for everyone! will make a note to look into that if it helps)
I'm not super keen on providing a default for everything though because it kind of hides everything you can configure. The content emitters and the composition local allowlists are things I'd love people to set up in almost every situation, so adding a default fallback might lead to unintended situations like some modules not properly configured missing that part of the custom config and not failing to run with that error you saw 😬
So we'll have to think about it and see the pros/cons before moving forward with that 😅
I encountered this same error. Can this be used together with io.gitlab.arturbosch.detekt:detekt-formatting
?
Use the fork at https://github.com/mrmans0n/compose-rules instead. It shouldn't be a problem there, plus all active development of this project moved there.
When the detektPlugin applied and rules added to the config file, CI build fails with error
Run failed with 1 invalid config property. - Property 'TwitterCompose' is misspelled or does not exist.
To Reproduce Steps to reproduce the behavior:
detekt-config.xml
Expected behavior Project compiles and CI build success
Instead it is failing on CI and locally, note that current detekt setup is working properly after deleting the TwitterCompose rule set.
Environment Version 1.21