Checkstyle4nb: Customised formats not working for the Naming Conventions
This post was updated on .
I have the following code naming convention requirements using the
checkstyle 4.1 version with Netbeans6.1.
The local variable needs to start with "l_" such as "l_varName" ,
the global variable needs with "m_" such as "m_varName" and
the method parameter needs with "p_" such as "p_parameterName"
I find the checkstyle allows the user to change the format for the Naming
http://checkstyle.sourceforge.net/config_naming.html which gives an example such as
<module name="MemberName"> <property name="format" value="^m[A-Z][a-zA-Z0-9]*$"/> </module>
Accordingly, I have made the following changes to the checkstyle-4.0.xml
file based on my required conventions:
While runnnig the checkstyle with the sample "TestConvention.java" file
with these setting, it throws the comments such as
"...TestConvention.java: Name 'm_assetId' must match pattern
'^[a-z][a-zA-Z0-9]*$'. " ,
"...TestConvention.java: Name 'm_clipBankTaxonomyTree' must match
pattern '^[a-z][a-zA-Z0-9]*$'. ",
"...TestConvention.java: Name 'p_clipBankTaxonomyTreeOfAssetMgr' must
match pattern '^[a-z][a-zA-Z0-9]*$'. ",
"...TestConvention.java: Name 'l_assetMgrTaxonomyTreeNodes' must
match pattern '^[a-z][a-zA-Z0-9]*$'. ".
I find this as a bug as the above customized formats are not taking into
A sample java file which is used to check for the conventions is