Skip to content

Can Detekt be used to create an annotation to enforce parameters in DSLs? #4886

Answered by cortinico
elect86 asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @elect86

As titled, I'm looking for a non-android solution to this, which uses an Android linter library:

That's totally doable. You can create your custom rule using this template https://github.com/detekt/detekt-custom-rule-template

And inspect the DSL calls + verify that certain parameters are declared or not. It can be totally custom (i.e. you hardcode the business logic inside the body of the rule) or you can provide some degree of configurability via external params or so.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by cortinico
Comment options

You must be logged in to vote
1 reply
@cortinico
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants