Property misspelled or does not exist, not sure what am I missing #5304
-
When I run ❯ ./gradlew clean
BUILD SUCCESSFUL in 1s
2 actionable tasks: 2 executed
❯ ./gradlew detekt
> Task :detekt-custom-rules:detekt FAILED
Property 'formatting' is misspelled or does not exist.
Property 'detekt-custom-rules' is misspelled or does not exist.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':detekt-custom-rules:detekt'.
> Run failed with 2 invalid config properties.
- Property 'formatting' is misspelled or does not exist.
- Property 'detekt-custom-rules' is misspelled or does not exist.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
3 actionable tasks: 3 executed
❯ ./gradlew detekt
> Task :detekt FAILED
Property 'detekt-custom-rules' is misspelled or does not exist.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':detekt'.
> Run failed with 1 invalid config property.
- Property 'detekt-custom-rules' is misspelled or does not exist.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
5 actionable tasks: 3 executed, 2 up-to-date I'm not sure what am I doing wrong as I get a different error on the same command. Could someone please have a look and help me? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 11 replies
-
The error message says that you have two keys in your config which are not valid: The |
Beta Was this translation helpful? Give feedback.
-
Thanks for taking a look @cortinico. Really appreciate the work you have done on detekt and providing support here for noobs like me :) . I'm coming from https://github.com/sds/overcommit and https://github.com/rubocop/rubocop, migrating to kotlin and detekt for good. I have imported the detekt formatting plugin here. Not sure what could be wrong with it. As mentioned in the previous comment when I ran the Yes, I plan to develop some custom rules in future. About the odd behaviour inhibited in the log provided previously. I'm able to reproduce it consistently. Here are the steps.
Because of the above behaviour, I'm not sure what is the correct way to import the formatting plugin and custom rules module. Unless there's a specific order the import should be arranged in. Please give the https://github.com/pr4bh4sh/detekt-demo a try if you are able to reproduce it. |
Beta Was this translation helpful? Give feedback.
-
I manage to run the custom rule. The issue was in Steps to reproduce
❯ ./gradlew clean
BUILD SUCCESSFUL in 729ms
2 actionable tasks: 2 executed
❯ ./gradlew detekt
> Task :detekt-custom-rules:detekt FAILED
Property 'formatting' is misspelled or does not exist.
Property 'detekt-custom-rules' is misspelled or does not exist.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':detekt-custom-rules:detekt'.
> Run failed with 2 invalid config properties.
- Property 'formatting' is misspelled or does not exist.
- Property 'detekt-custom-rules' is misspelled or does not exist.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
3 actionable tasks: 3 executed
❯ ./gradlew detekt
> Task :detekt FAILED
/Users/prabhashsingh/detekt-demo/src/test/kotlin/ruletest/InternalImport.kt:3:1: Importing 'ruletest.internal.InternalClass' which is an internal import. [NoInternalImportRule]
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':detekt'.
> Analysis failed with 1 weighted issues.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
5 actionable tasks: 3 executed, 2 up-to-date
``` |
Beta Was this translation helpful? Give feedback.
-
If you're using the CLI and the formatting rule you'll have to include the formatting plugin manually (as per this discussion) using |
Beta Was this translation helpful? Give feedback.
If you're using the CLI and the formatting rule you'll have to include the formatting plugin manually (as per this discussion) using
-p
or--plugins
parameter./gradlew detekt -p "app/build/detekt-formatter.jar"
You may download this jar from github and place it in the corresponding path initially.