saveourtool / diktat

Strict coding standard for Kotlin and a custom set of rules for detecting code smells, code style issues and bugs
https://diktat.saveourtool.com
MIT License
521 stars 39 forks source link

Add excludes (`List<String>`) property to configuration file like Detekt has #1325

Open WebTiger89 opened 2 years ago

WebTiger89 commented 2 years ago

Some suggestions: Add an excludes: ['SomeStringToExclude'] property to many rules.

Intention: I get 2 different warnings for an interface file with the name XModemPacket.kt

[FILE_NAME_INCORRECT] file name is incorrect - it should end with .kt extension and be in PascalCase: XModemPacket.kt

[CLASS_NAME_INCORRECT] class/enum/interface name should be in PascalCase and should contain only latin (ASCII) letters or numbers: XModemPacket

XModem is a term, so it makes sense to name this file as it is. So an excludes property for this rule would exclude specific file names, e.g. *excludes*: ['XModemPacket'] or excludes*: ['XModem']

You can also update the documentation in config file for [FILE_NAME_INCORRECT]. There is stated:

Checks that file name has extension

Append to the statement that this rule is also checking for PascalCase, as stated in the warning --> it should end with .kt extension and be in PascalCase

This would be a really useful feature.

WebTiger89 commented 2 years ago

I have found something else. In config file is stated for CLASS_NAME_INCORRECT:

Checks that the Class/Enum/Interface name does not match Pascal case

It should be "Checks that the Class/Enum/Interface name does match PascalCase.