diktat icon indicating copy to clipboard operation
diktat copied to clipboard

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

Open WebTiger89 opened this issue 3 years ago • 1 comments

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 avatar May 29 '22 00:05 WebTiger89

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.

WebTiger89 avatar May 29 '22 00:05 WebTiger89