Showing posts with label coding standards. Show all posts
Showing posts with label coding standards. Show all posts

Thursday, February 6, 2014

Check style - What is the meaning of inherit severity ?

Inherit severity indicates that, whatever is the parent severity will be applicable for a child element.

The default parent of every module is a 'checker', and default severity is 'warning'.

Look at the Checkstyle configuration file below.

<module name="Checker"> //Default Parent
  <property name="severity" value="warning"/>  //Default property of checker

  <module name="TreeWalker">
    <module name="JavadocMethod">
      <property name="severity" value="warning"/>
      <property name="suppressLoadErrors" value="true"/>
      <metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="error"/>
    </module>
    <module name="JavadocType"/>
    <module name="JavadocVariable"/>
    <module name="JavadocStyle">
      <property name="checkFirstSentence" value="false"/>
 .....

</module>


Resource:
http://checkstyle.sourceforge.net/config.html#Properties




Check Style Error- cannot initialize module TreeWalker - Unable to instantiate DoubleCheckedLocking

I was trying configure my old check style configuration file with the latest check style (Eclipse Checkstyle Plugin 5.6.1.201306282206) plugin. There is no issue during the configuration but during the activation of check style, it's throwing the below error.

cannot initialize module TreeWalker - Unable to instantiate DoubleCheckedLocking

After going through forums, what I understood was 'DoubleCheckedLocking' is not supported in the latest check style plug-in, since this attribute is exists in my old check style configuration file, it was throwing an error.

To resolve this, go to check style configuration file and remove the below line.

<module name="DoubleCheckedLocking"/>

Resource:
http://sourceforge.net/p/checkstyle/bugs/682/
http://checkstyle.sourceforge.net/releasenotes.html