Detekt: MatchingDeclarationName rule to match single declaration to file name

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

If the file is named Foo.kt and there's only one declaration (object, class, enum or interface) this file name should match the declaration name.

Positive case:

Something.kt

object Something

Negative case:

Something.kt

object Somethin

Also I'd expect this check to work when there are top level variables declared:

Something.kt

const val MEANING_OF_LIFE = 42

object Something

What do you think?

feature rules

All 3 comments

I want this rule too :D. Selfassigned.

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

Related issues

IlyaPavlovskii picture IlyaPavlovskii  路  3Comments

nipafx picture nipafx  路  4Comments

BraisGabin picture BraisGabin  路  4Comments

serj-lotutovici picture serj-lotutovici  路  3Comments

tylerbwong picture tylerbwong  路  4Comments