#574 new check: AbbreviationAsWordInTypeNameCheck

Check (274)
Roman Ivanov

Example: XMLReader should be names like XmlReader.
JShell name is ok - but JavaShell for some group of developers is preferable variant and they want to forbid "JShell" to stress distance from java api or standard classes (JPane , J.......).

Check name of the type to varidate abbreviations in capital letters.
Rule is simple: allowedCapitalCounts+1 and more capital character in sequence in name is not allowed.

Basic Options: extend AbbreviationAsWordInTypeNameCheck from TypeNameCheck

Option: int allowedCapitalCounts; //default is 2
Option: String ignoreNames; // will be regexp for exceptions in rules

We need to have ignore list to allow user to cover whole code by this rule, and do Name refactoring gradual for existing code. Some names are very hard to change (they are part of API or any other contract), so ignore list of names is vital.


  • Roman Ivanov
    Roman Ivanov

    We need to consider allowedCapitalCounts=3 by default because small Abbreviations does not looks good IoException - IOException is better

  • Roman Ivanov
    Roman Ivanov

    We need the same check for name of methods and fields and even variables.

  • Oliver Burn
    Oliver Burn

    Why not use a regular expression to handle preventing capital letters - e.g. "^A-Z*$".

    To allow for exceptions, add them to the regular expression - e.g. "^A-Z*$|^JPanel$"

  • Roman Ivanov
    Roman Ivanov

    int allowedCapitalCounts; //default is 2
    This option the only reason, and only this option helped to reconsile disputes about naming of the classes in our company. With regular expression there was too much exceptions. Without this option we can not switch this check at all.

  • Ivan Sopov
    Ivan Sopov

    • status: open --> closed
    • Group: --> Future