appKODE / detekt-rules-compose

A collection of Detekt rules for Jetpack Compose
MIT License
136 stars 8 forks source link

Add ignoreOverridden support for MissingModifierDefaultValue rule #11

Closed Sx1a9z4f closed 2 years ago

Sx1a9z4f commented 2 years ago

Since An overriding function is not allowed to specify default values ​​for its parameters I would like to be able to disable this rule for overriding functions.

dimsuz commented 2 years ago

Nice catch!

Perhaps this should even be done without adding the ignoreOverridden config option, i.e. it should always ignore overriding functions.

Or is there some case you see when this will be useful?

Sx1a9z4f commented 2 years ago

I really can't imagine such a situation) So it needs to be permanent.

Sx1a9z4f commented 2 years ago

It may still be worth including abstract functions, because they also will not have a default implementation

dimsuz commented 2 years ago

Right! Didn't think of that right away, will include them too.

BraisGabin commented 2 years ago

Same for interfaces. I'm getting this error:

Abstract Composable functions cannot have parameters with default values

dimsuz commented 2 years ago

Reopening as I have fixed the problem with overrides, but this rule will still report functions in abstract classes/interfaces. Will do a quick patch-release with the fix.