Checkstyle4nb: Customised formats not working for the Naming Conventions
dts <[email protected]> Fri, 1 May 2009 05:49:07 -0700 (PDT)
| Newsgroups | gmane.comp.java.audit.checkstyle.user |
|---|---|
| Message-ID | <[email protected]> |
Hello, 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" conventions. I find the checkstyle allows the user to change the format for the Naming Conventions modules 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: <module name="LocalFinalVariableNameCheck"> <property name="format" value="^l\_[a-z][a-zA-Z0-9]*$"/> <property name="severity" value="warning"/> </module> <module name="LocalVariableNameCheck"> <property name="format" value="^l\_[a-z][a-zA-Z0-9]*$"/> <property name="severity" value="warning"/> </module> <module name="MemberNameCheck"> <property name="format" value="^m\_[a-z][a-zA-Z0-9]*$"/> <property name="severity" value="warning"/> </module> <module name="StaticVariableNameCheck"> <property name="format" value="^m\_[a-z][a-zA-Z0-9]*$"/> <property name="severity" value="warning"/> </module> <module name="ParameterNameCheck"> <property name="format" value="^p\_[a-z][a-zA-Z0-9]*$"/> <property name="severity" value="warning"/> </module> While runnnig the checkstyle with the sample "TestConvention.java" file with these setting, it throws the comments such as "...TestConvention.java[20]: Name 'm_assetId' must match pattern '^[a-z][a-zA-Z0-9]*$'. " , "...TestConvention.java[25]: Name 'm_clipBankTaxonomyTree' must match pattern '^[a-z][a-zA-Z0-9]*$'. ", "...TestConvention.java[46]: Name 'p_clipBankTaxonomyTreeOfAssetMgr' must match pattern '^[a-z][a-zA-Z0-9]*$'. ", "...TestConvention.java[48]: 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 consideration.. A sample java file which is used to check for the conventions is attached. Kindly do the needful. Thanks in advance, Dilip -- View this message in context: http://www.nabble.com/Checkstyle4nb%3A-Customised-formats-not-working-for-the-Naming-Conventions-tp23330780p23330780.html Sent from the CheckStyle - User mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Register Now & Save for Velocity, the Web Performance & Operations Conference from O'Reilly Media. Velocity features a full day of expert-led, hands-on workshops and two days of sessions from industry leaders in dedicated Performance & Operations tracks. Use code vel09scf and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf