diktat icon indicating copy to clipboard operation
diktat copied to clipboard

Usage of standard type names in generics should be prohibited

Open orchestr7 opened this issue 3 years ago • 2 comments

Quite confusing, isn't it?

    fun<Int> foo(a: Int) {
    }

Need to prohibit naming of generic types with standard Kotlin types (kotlin.kotlin_builtins)

orchestr7 avatar Jun 03 '22 13:06 orchestr7

There is a common suggestion to use a single letter for generic types (for example in java Generic Types -> Type Parameter Naming Conventions, or sonar: squid:S00119). We can add similar rule to diktat

nulls avatar Jun 07 '22 06:06 nulls

use a single letter for generic types

We actually have this logic in diktat, described here

petertrr avatar Jun 07 '22 07:06 petertrr