sonar-checkstyle icon indicating copy to clipboard operation
sonar-checkstyle copied to clipboard

make it clear to user that TreeWalker has hardcoded FileContentsHolder and SuppressWarningsHolder

Open romani opened this issue 8 years ago • 1 comments

Taken from #98

When I define one rule in a sonar profile, like Indentation, the following configuration is created:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
<!-- Generated by Sonar -->
<module name="Checker">
  <module name="SuppressionCommentFilter"/>
  <module name="SuppressWarningsFilter"/>
  <module name="TreeWalker">
    <module name="FileContentsHolder"/>
    <module name="SuppressWarningsHolder"/>
    <module name="Indentation">
      <property name="severity" value="info"/>
      <property name="throwsIndent" value="4"/>
      <property name="arrayInitIndent" value="4"/>
      <property name="forceStrictCondition" value="false"/>
      <property name="caseIndent" value="4"/>
      <property name="basicOffset" value="4"/>
      <property name="braceAdjustment" value="0"/>
      <property name="lineWrappingIndentation" value="4"/>
    </module>
  </module>
</module>

It should also be noted since we are auto-adding FileContentsHolder and SuppressWarningsHolder, we can remove them from the rules file as only 1 instance is needed.

romani avatar Apr 05 '17 23:04 romani

SuppressWarningsHolder is required for http://checkstyle.sourceforge.net/config_filters.html#SuppressWarningsFilter , as it default filter currently , so SuppressWarningsHolder exists in config by default only to let default filter work

FileContentsHolder is required for http://checkstyle.sourceforge.net/config_filters.html#SuppressionCommentFilter for the same reason.

romani avatar Apr 05 '17 23:04 romani