Extending existing rules #7072
-
Hi all, I'm working on updating our Detekt configuration to be more friendly for Compose. One issue that our developers are running into is the LongParameterList rule. I've reviewed the guidance and suggestions here, but was wondering if there was a way we could actually extend the I tried creating a custom rule and extending the So I have two questions:
Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I don't understand what you mean by outer- and inner-rule. Nevertheless, the suggested approach is to copy the source code of Just setting classes of built-in rules to open doesn't provide a remedy, because you also need to provide hooks for all possible parts needing to be customized. I don't think it's worth the effort. |
Beta Was this translation helpful? Give feedback.
-
That's the suggested approach. If there is a snippet of code that is frequently re-used to manipulate the PSI, we can consider exposing it as a public API (i.e. see the But we don't offer an easy way to 'extend' rules as you're suggesting as that will make our API surface explode |
Beta Was this translation helpful? Give feedback.
I don't understand what you mean by outer- and inner-rule.
Nevertheless, the suggested approach is to copy the source code of
LongParameterList
as it is to a custom rule and modify the needed parts.Just setting classes of built-in rules to open doesn't provide a remedy, because you also need to provide hooks for all possible parts needing to be customized. I don't think it's worth the effort.