@Configuration("ignores variables in classes which match this regex")
private val excludeClassPattern: Regex by config("$^") { it.toRegex() }
Should I use them in my custom rules? If yes, what will they do?
I've searched for example/explanation in api doc and detekt.dev, but there's no indication on the final effect of these.
m
marschwar
07/03/2023, 11:37 AM
In the detekt code base they are used to generate the documentation as well as the default config file. That will not work for custom rules.
But the config params are also evaluated against your config file at runtime. That mechanism should be available for custom rules as well. That being said - I have never tried that.
If you end up trying, please either create an issue if it does not work or one that there is documentation missing on how to integrate with custom rules.
b
Brais Gabin
07/03/2023, 11:43 AM
We have a module called
detekt-generator
that generates all the documentation of detekt. We worked a bit to make it useful for third parties but I think that no one used yet so we didn't push it too much. Any help/feedback in that department is more than welcome.
That module should generate a cli that should be able to parse any ruleset and generate markdowns with the docs and the default configuration file.
d
dimsuz
07/03/2023, 11:51 AM
Oh, that's great to hear, I have a long standing plan to generate documentation for detekt-rules-compose which is as cool as the one in detekt, will check out
detekt-generator
for that once I get my hands on it.
b
Brais Gabin
07/03/2023, 2:03 PM
Let us know how is it going.
Brais Gabin
07/03/2023, 2:03 PM
We would like to give support for that use case
d
dimsuz
07/03/2023, 3:15 PM
Will do! My pace is usually not as quick as I'd like to, but when I get there I'll let you know if I'll have any questions/problems.