Detekt: Consider adding `excludeAnnotatedClasses` to UseDataClass.

Created on 15 Jan 2018  路  3Comments  路  Source: detekt/detekt

I found myself in need of an exclude because some classes that are more configuration that data, give these false positives. For example:

@Module
class MyModule(
    @get:Provides val someVal: SomeInterface, 
    @get:Provides val otherVal:SomeOtherInterface
)

I could just add a suppress here, but it seems wrong because an object of this class will never require an equals or hashCode.

improvement rules

Most helpful comment

This addition does make sense for the rule, though. Especially in Android we'll see quite a few of these annotated classes which don't need to be data classes.

All 3 comments

I hate annotation-driven-development :(

This addition does make sense for the rule, though. Especially in Android we'll see quite a few of these annotated classes which don't need to be data classes.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related topics.

Was this page helpful?
0 / 5 - 0 ratings