Eugene Peh
Eugene Peh

Reputation: 11

checkstyle module name ConstantName vs ConstantNameCheck

I have a question to ask regarding checkstyle. It seems that the checkstyle api accepts both module name, ConstantName and ConstantNameCheck (ConstantName with Check concatenated) for the configuration file, checkstyle.xml.

I would like to ask why is there a double standard here even though documentations on http://checkstyle.sourceforge.net/ only promotes ConstantName module and what is the difference between using either of them? Will either one of them gets deprecated in future?

Thanks!

Upvotes: 1

Views: 415

Answers (1)

barfuin
barfuin

Reputation: 17494

Behind the scenes, the ConstantName check is implemented by a Java class called com.puppycrawl.tools.checkstyle.checks.naming.ConstantNameCheck.

You could actually refer to the module in checkstyle.xml by this so-called "fully qualified" name. The other notations are shorthand offered by Checkstyle for convenience. ConstantNameCheck is the simple name of the implementing Java class, and ConstantName is still shorter. Checkstyle will try all three variants when looking for the module in your checkstyle.xml. So, there is no difference between these notations.

The recommended way is to use the most concise form, ConstantName, but as far as I know, none of the other forms is going to get deprecated any time soon.

Upvotes: 0

Related Questions