Hi! :wave: I see `Configuration` annotations like...
# detekt
d
Hi! 👋 I see
Configuration
annotations like this in detekt's built-in rules:
Copy code
@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
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
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
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
Let us know how is it going.
We would like to give support for that use case
d
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.