Skip to content

Instantly share code, notes, and snippets.

@attatrol
Created July 21, 2015 13:23
Show Gist options
  • Save attatrol/699fd9863de8730dfc30 to your computer and use it in GitHub Desktop.
Save attatrol/699fd9863de8730dfc30 to your computer and use it in GitHub Desktop.
<section name="SuppressionAnnotationFilter">
<subsection name="Description">
<p>
Suppress all reports from elements annotated by user defined annotations.
It is possible to define checks that will bypass the filter.
</p>
<p>
Example:
</p>
<code>
@UserAnnotation
public void foo(){
//here bad code
//that should be suppressed
}
</code>
</subsection>
<subsection name="Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
</tr>
<tr>
<td>annotationName</td>
<td>Names of suppressive annotations.
Can be either simple or fully-qualified.
Simple name will affect all fully-qualified annotations that match it.
AT symbol is facultative.</td>
<td><a href="property_types.html#stringSet">String Set</a></td>
<td><code>{ }</code></td>
</tr>
<tr>
<td>permittedChecks</td>
<td>Regular expressions that matches checks, which should bypass the filter.</td>
<td><a href="property_types.html#stringSet">String Set</a></td>
<td><code>{ }</code></td>
</tr>
<tr>
<td>modifiersExcluded</td>
<td>Excludes modifiers of an annotated element from filtered area.
Javadocs are included in modifiers.</td>
<td><a href="property_types.html#boolean">boolean</a></td>
<td><code>true</code></td>
</tr>
</table>
</subsection>
<subsection name="Dependencies">
<p>
You have to add DetailAstRootHolder check into TreeWalker section of your configuration for correct work of this filter. Without this addition filter won't suppress anything.
</p>
<code>
&lt;module name=&quot;Checker&quot;&gt;
...
&lt;module name=&quot;TreeWalker&quot;&gt;
...
&lt;module name=&quot;DetailAstRootHolder&quot;/&gt;
...
&lt;/module&gt;
...
&lt;module name=&quot;SuppressionAnnotationFilter&quot;&gt;
&lt;property name=&quot;annotationName&quot; value=&quot;UserAnnotation&quot;/&gt;
&lt;/module&gt;
&lt;/module&gt;
</code>
</subsection>
<subsection name="Examples">
<p>
Suppose you have non-formatted class generated by some automatic tool.
</p>
<code>
@Generated
class GeneratedClass{
/** loads of messy code */
}
</code>
<p>
With this configuration there will be no warnings or errors from this class exept for UserAllowedCheck.
</p>
<code>
&lt;module name=&quot;Checker&quot;&gt;
...
&lt;module name=&quot;TreeWalker&quot;&gt;
...
&lt;module name=&quot;DetailAstRootHolder&quot;/&gt;
...
&lt;/module&gt;
...
&lt;module name=&quot;SuppressionAnnotationFilter&quot;&gt;
&lt;property name=&quot;annotationName&quot; value=&quot;Generated&quot;/&gt;
&lt;property name=&quot;permittedChecks&quot; value=&quot;^(?!UserAllowedCheck$).*&quot;/&gt;
&lt;/module&gt;
&lt;/module&gt;
</code>
</subsection>
</section>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment