hello , i want to know how to use detekt with formatting plugin in a multi module project, in a way ...
a
hello , i want to know how to use detekt with formatting plugin in a multi module project, in a way to include/exclude sub projects , should detekt configuration and dependencies be present in each sub project build file ? or just in the root build file ? i tried but i keep getting this error :
Execution failed for task ':app:detekt'.
Run failed with 1 invalid config property.
- Property 'formatting' is misspelled or does not exist.
b
Differen options here. If you just want to remove that error you can add this on the yaml:
Copy code
config:
  excludes: "formatting"
You know that you are not configuring
formatting
on all the modules so it's fine to don't care when it's configured in modules that doesn't have it
Other options is to have the plugin always applied but change the
config
file between modules. I don't think there is a "correct" answer here. It's just what you prefer
Other option is to have a defalt config and apply one extra configuration overriding the part that you want to change
a
so I did what you suggested by always apply the plugin , but instead of adding extra config to subprojects I overridden the source property that detekt use by default to include only covered subprojects like this :
detekt{
source=files("app","core","lib")
}
the issue i'm facing now is that "autoCorrect" for formatting rule in yaml config has no effect when set to "true" , maybe it's a bug idk
Copy code
formatting:
  active: true
  android: true
  autoCorrect: true
I found that autocorrect should be set explicitly in detekt config for gradle plugin
974 Views