sonar-checkstyle
sonar-checkstyle copied to clipboard
make it clear to user that TreeWalker has hardcoded FileContentsHolder and SuppressWarningsHolder
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.
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.