Issue #2292: fixed xdoc check order errors

This commit is contained in:
rnveach 2015-11-02 21:02:03 -05:00 committed by Roman Ivanov
parent e5d5133195
commit 879738dc84
12 changed files with 5085 additions and 5084 deletions

View File

@ -21,6 +21,154 @@
</macro>
</section>
<section name="AnnotationLocation">
<subsection name="Description">
<p>
Check location of annotation on language elements.
By default, Check enforce to locate annotations immediately
after documentation block and before target element, annotation should be located on separate line from target element.
</p>
<p>
Example:
</p>
<source>
@Override
@Nullable
public String getNameIfPresent() { ... }
</source>
</subsection>
<subsection name="Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
</tr>
<tr>
<td>allowSamelineMultipleAnnotations</td>
<td>To allow annotation to be located on the same line as target element.</td>
<td><a href="property_types.html#boolean">boolean</a></td>
<td><code>false</code></td>
</tr>
<tr>
<td>allowSamelineSingleParameterlessAnnotation</td>
<td>To allow single prameterless annotation to be located on the same line as target element.</td>
<td><a href="property_types.html#boolean">boolean</a></td>
<td><code>true</code></td>
</tr>
<tr>
<td>allowSamelineParameterizedAnnotation</td>
<td>To allow parameterized annotation to be located on the same line as target element.</td>
<td><a href="property_types.html#boolean">boolean</a></td>
<td><code>false</code></td>
</tr>
<tr>
<td>tokens</td>
<td>tokens to check</td>
<td>subset of tokens
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#CLASS_DEF">CLASS_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#INTERFACE_DEF">INTERFACE_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ENUM_DEF">ENUM_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#METHOD_DEF">METHOD_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#CTOR_DEF">CTOR_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#VARIABLE_DEF">VARIABLE_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#PARAMETER_DEF">PARAMETER_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ANNOTATION_DEF">ANNOTATION_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#TYPECAST">TYPECAST</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#LITERAL_THROWS">LITERAL_THROWS</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#IMPLEMENTS_CLAUSE">IMPLEMENTS_CLAUSE</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#TYPE_ARGUMENT">TYPE_ARGUMENT</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#LITERAL_NEW">LITERAL_NEW</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#DOT">DOT</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ANNOTATION_FIELD_DEF">ANNOTATION_FIELD_DEF</a>.
</td>
<td>
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#CLASS_DEF">CLASS_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#INTERFACE_DEF">INTERFACE_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ENUM_DEF">ENUM_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#METHOD_DEF">METHOD_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#CTOR_DEF">CTOR_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#VARIABLE_DEF">VARIABLE_DEF</a>.
</td>
</tr>
</table>
</subsection>
<subsection name="Examples">
<p>
Example to allow single parameterless annotation on the same line
</p>
<source>
@Override public int hashCode() { ... }
</source>
<p>
Use following configuration:
</p>
<source>
&lt;module name=&quot;AnnotationLocation&quot;&gt;
&lt;property name=&quot;allowSamelineMultipleAnnotations&quot; value=&quot;false&quot;/&gt;
&lt;property name=&quot;allowSamelineSingleParameterlessAnnotation&quot; value=&quot;true&quot;/&gt;
&lt;property name=&quot;allowSamelineParameterizedAnnotation&quot; value=&quot;false&quot;/&gt;
&lt;/module&gt;
</source>
<p>
Example to allow multiple parameterized annotations on the same line
</p>
<source>
@SuppressWarnings("deprecation") @Mock DataLoader loader;
</source>
<p>
Use following configuration:
</p>
<source>
&lt;module name=&quot;AnnotationLocation&quot;&gt;
&lt;property name=&quot;allowSamelineMultipleAnnotations&quot; value=&quot;true&quot;/&gt;
&lt;property name=&quot;allowSamelineSingleParameterlessAnnotation&quot; value=&quot;true&quot;/&gt;
&lt;property name=&quot;allowSamelineParameterizedAnnotation&quot; value=&quot;true&quot;/&gt;
&lt;/module&gt;
</source>
<p>
Example to allow multiple parameterless annotations on the same line
</p>
<source>
@Partial @Mock DataLoader loader;
</source>
<p>
Use following configuration:
</p>
<source>
&lt;module name=&quot;AnnotationLocation&quot;&gt;
&lt;property name=&quot;allowSamelineMultipleAnnotations&quot; value=&quot;true&quot;/&gt;
&lt;property name=&quot;allowSamelineSingleParameterlessAnnotation&quot; value=&quot;true&quot;/&gt;
&lt;property name=&quot;allowSamelineParameterizedAnnotation&quot; value=&quot;false&quot;/&gt;
&lt;/module&gt;
</source>
</subsection>
<subsection name="Example of Usage">
<ul>
<li>
<a href="https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml#L167-L169">
Google Style</a>
</li>
<li>
<a href="https://github.com/checkstyle/checkstyle/blob/master/config/checkstyle_checks.xml#L239">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Package">
<p> com.puppycrawl.tools.checkstyle.checks.annotation </p>
</subsection>
<subsection name="Parent Module">
<p> <a href="config.html#TreeWalker">TreeWalker</a> </p>
</subsection>
</section>
<section name="AnnotationUseStyle">
<subsection name="Description">
<p> This check controls the style with the usage of annotations.
@ -469,153 +617,5 @@
</subsection>
</section>
<section name="AnnotationLocation">
<subsection name="Description">
<p>
Check location of annotation on language elements.
By default, Check enforce to locate annotations immediately
after documentation block and before target element, annotation should be located on separate line from target element.
</p>
<p>
Example:
</p>
<source>
@Override
@Nullable
public String getNameIfPresent() { ... }
</source>
</subsection>
<subsection name="Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
</tr>
<tr>
<td>allowSamelineMultipleAnnotations</td>
<td>To allow annotation to be located on the same line as target element.</td>
<td><a href="property_types.html#boolean">boolean</a></td>
<td><code>false</code></td>
</tr>
<tr>
<td>allowSamelineSingleParameterlessAnnotation</td>
<td>To allow single prameterless annotation to be located on the same line as target element.</td>
<td><a href="property_types.html#boolean">boolean</a></td>
<td><code>true</code></td>
</tr>
<tr>
<td>allowSamelineParameterizedAnnotation</td>
<td>To allow parameterized annotation to be located on the same line as target element.</td>
<td><a href="property_types.html#boolean">boolean</a></td>
<td><code>false</code></td>
</tr>
<tr>
<td>tokens</td>
<td>tokens to check</td>
<td>subset of tokens
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#CLASS_DEF">CLASS_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#INTERFACE_DEF">INTERFACE_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ENUM_DEF">ENUM_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#METHOD_DEF">METHOD_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#CTOR_DEF">CTOR_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#VARIABLE_DEF">VARIABLE_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#PARAMETER_DEF">PARAMETER_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ANNOTATION_DEF">ANNOTATION_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#TYPECAST">TYPECAST</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#LITERAL_THROWS">LITERAL_THROWS</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#IMPLEMENTS_CLAUSE">IMPLEMENTS_CLAUSE</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#TYPE_ARGUMENT">TYPE_ARGUMENT</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#LITERAL_NEW">LITERAL_NEW</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#DOT">DOT</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ANNOTATION_FIELD_DEF">ANNOTATION_FIELD_DEF</a>.
</td>
<td>
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#CLASS_DEF">CLASS_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#INTERFACE_DEF">INTERFACE_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ENUM_DEF">ENUM_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#METHOD_DEF">METHOD_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#CTOR_DEF">CTOR_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#VARIABLE_DEF">VARIABLE_DEF</a>.
</td>
</tr>
</table>
</subsection>
<subsection name="Examples">
<p>
Example to allow single parameterless annotation on the same line
</p>
<source>
@Override public int hashCode() { ... }
</source>
<p>
Use following configuration:
</p>
<source>
&lt;module name=&quot;AnnotationLocation&quot;&gt;
&lt;property name=&quot;allowSamelineMultipleAnnotations&quot; value=&quot;false&quot;/&gt;
&lt;property name=&quot;allowSamelineSingleParameterlessAnnotation&quot; value=&quot;true&quot;/&gt;
&lt;property name=&quot;allowSamelineParameterizedAnnotation&quot; value=&quot;false&quot;/&gt;
&lt;/module&gt;
</source>
<p>
Example to allow multiple parameterized annotations on the same line
</p>
<source>
@SuppressWarnings("deprecation") @Mock DataLoader loader;
</source>
<p>
Use following configuration:
</p>
<source>
&lt;module name=&quot;AnnotationLocation&quot;&gt;
&lt;property name=&quot;allowSamelineMultipleAnnotations&quot; value=&quot;true&quot;/&gt;
&lt;property name=&quot;allowSamelineSingleParameterlessAnnotation&quot; value=&quot;true&quot;/&gt;
&lt;property name=&quot;allowSamelineParameterizedAnnotation&quot; value=&quot;true&quot;/&gt;
&lt;/module&gt;
</source>
<p>
Example to allow multiple parameterless annotations on the same line
</p>
<source>
@Partial @Mock DataLoader loader;
</source>
<p>
Use following configuration:
</p>
<source>
&lt;module name=&quot;AnnotationLocation&quot;&gt;
&lt;property name=&quot;allowSamelineMultipleAnnotations&quot; value=&quot;true&quot;/&gt;
&lt;property name=&quot;allowSamelineSingleParameterlessAnnotation&quot; value=&quot;true&quot;/&gt;
&lt;property name=&quot;allowSamelineParameterizedAnnotation&quot; value=&quot;false&quot;/&gt;
&lt;/module&gt;
</source>
</subsection>
<subsection name="Example of Usage">
<ul>
<li>
<a href="https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml#L167-L169">
Google Style</a>
</li>
<li>
<a href="https://github.com/checkstyle/checkstyle/blob/master/config/checkstyle_checks.xml#L239">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Package">
<p> com.puppycrawl.tools.checkstyle.checks.annotation </p>
</subsection>
<subsection name="Parent Module">
<p> <a href="config.html#TreeWalker">TreeWalker</a> </p>
</subsection>
</section>
</body>
</document>

View File

@ -21,6 +21,119 @@
</macro>
</section>
<section name="AvoidNestedBlocks">
<subsection name="Description">
<p>
Finds nested blocks, i.e. blocks that are used freely in the code.
</p>
<p>
Rationale: Nested blocks are often leftovers from the
debugging process, they confuse the reader.
</p>
<p>
For example this Check finds the obsolete braces in
</p>
<source>
public void guessTheOutput()
{
int whichIsWhich = 0;
{
int whichIsWhich = 2;
}
System.out.println("value = " + whichIsWhich);
}
</source>
<p> and debugging / refactoring leftovers such as </p>
<source>
// if (conditionThatIsNotUsedAnyLonger)
{
System.out.println("unconditional");
}
</source>
<p>
A case in a switch statement does not implicitly form a block.
Thus to be able to introduce local variables that have case
scope it is necessary to open a nested block. This is
supported, set the allowInSwitchCase property to true and
include all statements of the case in the block.
</p>
<source>
switch (a)
{
case 0:
// Never OK, break outside block
{
x = 1;
}
break;
case 1:
// Never OK, statement outside block
System.out.println("Hello");
{
x = 2;
break;
}
case 1:
// OK if allowInSwitchCase is true
{
System.out.println("Hello");
x = 2;
break;
}
}
</source>
</subsection>
<subsection name="Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
</tr>
<tr>
<td>allowInSwitchCase</td>
<td>Allow nested blocks in case statements</td>
<td><a href="property_types.html#boolean">boolean</a></td>
<td><code>false</code></td>
</tr>
</table>
</subsection>
<subsection name="Examples">
<p> To configure the check: </p>
<source>
&lt;module name=&quot;AvoidNestedBlocks&quot;/&gt;
</source>
</subsection>
<subsection name="Example of Usage">
<ul>
<li>
<a href="https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/sun_checks.xml#L134">
Sun Style</a>
</li>
<li>
<a href="https://github.com/checkstyle/checkstyle/blob/master/config/checkstyle_checks.xml#L243-L245">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Package">
<p> com.puppycrawl.tools.checkstyle.checks.blocks </p>
</subsection>
<subsection name="Parent Module">
<p> <a href="config.html#TreeWalker">TreeWalker</a> </p>
</subsection>
</section>
<section name="EmptyBlock">
<subsection name="Description">
<p> Checks for empty blocks. </p>
@ -645,118 +758,5 @@ switch (num) {
<p> <a href="config.html#TreeWalker">TreeWalker</a> </p>
</subsection>
</section>
<section name="AvoidNestedBlocks">
<subsection name="Description">
<p>
Finds nested blocks, i.e. blocks that are used freely in the code.
</p>
<p>
Rationale: Nested blocks are often leftovers from the
debugging process, they confuse the reader.
</p>
<p>
For example this Check finds the obsolete braces in
</p>
<source>
public void guessTheOutput()
{
int whichIsWhich = 0;
{
int whichIsWhich = 2;
}
System.out.println("value = " + whichIsWhich);
}
</source>
<p> and debugging / refactoring leftovers such as </p>
<source>
// if (conditionThatIsNotUsedAnyLonger)
{
System.out.println("unconditional");
}
</source>
<p>
A case in a switch statement does not implicitly form a block.
Thus to be able to introduce local variables that have case
scope it is necessary to open a nested block. This is
supported, set the allowInSwitchCase property to true and
include all statements of the case in the block.
</p>
<source>
switch (a)
{
case 0:
// Never OK, break outside block
{
x = 1;
}
break;
case 1:
// Never OK, statement outside block
System.out.println("Hello");
{
x = 2;
break;
}
case 1:
// OK if allowInSwitchCase is true
{
System.out.println("Hello");
x = 2;
break;
}
}
</source>
</subsection>
<subsection name="Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
</tr>
<tr>
<td>allowInSwitchCase</td>
<td>Allow nested blocks in case statements</td>
<td><a href="property_types.html#boolean">boolean</a></td>
<td><code>false</code></td>
</tr>
</table>
</subsection>
<subsection name="Examples">
<p> To configure the check: </p>
<source>
&lt;module name=&quot;AvoidNestedBlocks&quot;/&gt;
</source>
</subsection>
<subsection name="Example of Usage">
<ul>
<li>
<a href="https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/sun_checks.xml#L134">
Sun Style</a>
</li>
<li>
<a href="https://github.com/checkstyle/checkstyle/blob/master/config/checkstyle_checks.xml#L243-L245">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Package">
<p> com.puppycrawl.tools.checkstyle.checks.blocks </p>
</subsection>
<subsection name="Parent Module">
<p> <a href="config.html#TreeWalker">TreeWalker</a> </p>
</subsection>
</section>
</body>
</document>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -89,221 +89,6 @@
</subsection>
</section>
<section name="SuppressionFilter">
<subsection name="Description">
<p>
Filter <code>SuppressionFilter</code> rejects
audit events for Check errors according to
a <a href="config.html#XML_Structure"><em>suppressions XML
document</em></a> in a file. If there is no configured
suppressions file, the Filter accepts all audit events.
</p>
</subsection>
<subsection name="Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
</tr>
<tr>
<td>file</td>
<td>
the location of the <em>suppressions XML document</em> file.
The order the location is checked is:
<ol>
<li>as a filesystem location</li>
<li>
if no file found, and the location starts with either
<code>http://</code> or <code>https://</code>, then it
is interpreted as a URL
</li>
<li>
if no file found, then passed to the
<code>ClassLoader.getResource()</code> method.
</li>
</ol>
</td>
<td><a href="property_types.html#string">string</a></td>
<td><code>none</code></td>
</tr>
</table>
</subsection>
<subsection name="Examples">
<p>
For example, the following configuration fragment directs the
Checker to use a <code>SuppressionFilter</code>
with suppressions
file <code>config/suppressions.xml</code>:
</p>
<source>
&lt;module name=&quot;SuppressionFilter&quot;&gt;
&lt;property name=&quot;file&quot; value=&quot;config/suppressions.xml&quot;/&gt;
&lt;/module&gt;
</source>
<p>
A <a href="config.html#XML_Structure"><em>suppressions XML
document</em></a> contains a set
of <code>suppress</code> elements, where
each <code>suppress</code> element can have the
following attributes:
</p>
<ul>
<li>
<code>files</code> -
a <a href="property_types.html#regexp">regular expression</a>
matched against the file name associated with an audit
event. It is mandatory.
</li>
<li>
<code>checks</code> -
a <a href="property_types.html#regexp">regular expression</a>
matched against the name of the check associated with an audit
event. Optional if <code>id</code> is specified.
</li>
<li>
<code>id</code> -
a <a href="property_types.html#string">string</a>
matched against the ID of the check associated with an audit
event. Optional if <code>checks</code> is specified.
</li>
<li>
<code>lines</code> - a comma-separated list of
values, where each value is
an <a href="property_types.html#integer">integer</a> or a
range of integers denoted by integer-integer. It is optional.
</li>
<li>
<code>columns</code> - a comma-separated list of
values, where each value is
an <a href="property_types.html#integer">integer</a> or a
range of integers denoted by integer-integer. It is optional.
</li>
</ul>
<p>
Each audit event is checked against
each <code>suppress</code> element. It is
suppressed if all specified attributes match against the audit
event.
</p>
<p>
You can download template of empty suppression filter
<a href="files/suppressions_none.xml">here</a>.
</p>
<p>
The following suppressions XML document directs
a <code>SuppressionFilter</code> to
reject <code>JavadocStyleCheck</code> errors for
lines 82 and 108 to 122 of
file <code>AbstractComplexityCheck.java</code>,
and <code>MagicNumberCheck</code> errors for line
221 of file <code>JavadocStyleCheck.java</code>:
</p>
<source>
&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;!DOCTYPE suppressions PUBLIC
&quot;-//Puppy Crawl//DTD Suppressions 1.1//EN&quot;
&quot;http://www.puppycrawl.com/dtds/suppressions_1_1.dtd&quot;&gt;
&lt;suppressions&gt;
&lt;suppress checks=&quot;JavadocStyleCheck&quot;
files=&quot;AbstractComplexityCheck.java&quot;
lines=&quot;82,108-122&quot;/&gt;
&lt;suppress checks=&quot;MagicNumberCheck&quot;
files=&quot;JavadocStyleCheck.java&quot;
lines=&quot;221&quot;/&gt;
&lt;/suppressions&gt;
</source>
<p>
As another example to suppress Check by module id:
</p>
<source>
&lt;module name=&quot;DescendantToken&quot;&gt;
&lt;property name=&quot;id&quot; value=&quot;stringEqual&quot;/&gt;
&lt;property name=&quot;tokens&quot; value=&quot;EQUAL,NOT_EQUAL&quot;/&gt;
&lt;property name=&quot;limitedTokens&quot; value=&quot;STRING_LITERAL&quot;/&gt;
&lt;property name=&quot;maximumNumber&quot; value=&quot;0&quot;/&gt;
&lt;property name=&quot;maximumDepth&quot; value=&quot;1&quot;/&gt;
&lt;/module&gt;
&lt;module name=&quot;DescendantToken&quot;&gt;
&lt;property name=&quot;id&quot; value=&quot;switchNoDefault&quot;/&gt;
&lt;property name=&quot;tokens&quot; value=&quot;LITERAL_SWITCH&quot;/&gt;
&lt;property name=&quot;maximumDepth&quot; value=&quot;2&quot;/&gt;
&lt;property name=&quot;limitedTokens&quot; value=&quot;LITERAL_DEFAULT&quot;/&gt;
&lt;property name=&quot;minimumNumber&quot; value=&quot;1&quot;/&gt;
&lt;/module&gt;
</source>
<p>
Then the following can be used to suppress only the first
check and not the second by using
the <code>id</code> attribute:
</p>
<source>
&lt;suppress id=&quot;stringEqual&quot; files=&quot;SomeTestCode.java&quot;/&gt;
</source>
<p>
Suppress checks for hidden files and folders:
</p>
<source>
&lt;suppress files=&quot;[/\\]\..+&quot; checks=&quot;.*&quot;/&gt;
</source>
<p>
Suppress checks for Maven-generated code:
</p>
<source>
&lt;suppress files=&quot;[/\\]target[/\\]&quot; checks=&quot;.*&quot;/&gt;
</source>
<p>
Suppress checks for archives, classes and other binary files:
</p>
<source>
&lt;suppress files=&quot;.+\.(?:jar|zip|war|class|tar|bin)$&quot; checks=&quot;.*&quot;/&gt;
</source>
<p>
Suppress checks for image files:
</p>
<source>
&lt;suppress files=&quot;.+\.(?:png|gif|jpg|jpeg)$&quot; checks=&quot;.*&quot;/&gt;
</source>
<p>
Suppress checks for non-java files:
</p>
<source>
&lt;suppress files=&quot;.+\.(?:txt|xml|csv|sh|thrift|html|sql|eot|ttf|woff|css|png)$&quot; checks=&quot;.*&quot;/&gt;
</source>
<p>
Suppress all checks in generated sources:
</p>
<source>
&lt;suppress checks=&quot;.*&quot; files=&quot;com[\\/]mycompany[\\/]app[\\/]gen[\\/]&quot;/&gt;
</source>
<p>
Suppress FileLength check on integration tests in certain folder:
</p>
<source>
&lt;suppress checks=&quot;FileLength&quot; files=&quot;com[\\/]mycompany[\\/]app[\\/].*IT.java&quot;/&gt;
</source>
</subsection>
<subsection name="Example of Usage">
<ul>
<li>
<a href="https://github.com/checkstyle/checkstyle/blob/master/config/checkstyle_checks.xml#L21">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Package">
<p> com.puppycrawl.tools.checkstyle.filters </p>
</subsection>
<subsection name="Parent Module">
<p> <a href="config.html#Checker">Checker</a> </p>
</subsection>
</section>
<section name="SuppressionCommentFilter">
<subsection name="Description">
<p>
@ -550,6 +335,288 @@ HashSet hashSet; // Warning here: Declaring variables, return values or paramete
</subsection>
</section>
<section name="SuppressionFilter">
<subsection name="Description">
<p>
Filter <code>SuppressionFilter</code> rejects
audit events for Check errors according to
a <a href="config.html#XML_Structure"><em>suppressions XML
document</em></a> in a file. If there is no configured
suppressions file, the Filter accepts all audit events.
</p>
</subsection>
<subsection name="Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
</tr>
<tr>
<td>file</td>
<td>
the location of the <em>suppressions XML document</em> file.
The order the location is checked is:
<ol>
<li>as a filesystem location</li>
<li>
if no file found, and the location starts with either
<code>http://</code> or <code>https://</code>, then it
is interpreted as a URL
</li>
<li>
if no file found, then passed to the
<code>ClassLoader.getResource()</code> method.
</li>
</ol>
</td>
<td><a href="property_types.html#string">string</a></td>
<td><code>none</code></td>
</tr>
</table>
</subsection>
<subsection name="Examples">
<p>
For example, the following configuration fragment directs the
Checker to use a <code>SuppressionFilter</code>
with suppressions
file <code>config/suppressions.xml</code>:
</p>
<source>
&lt;module name=&quot;SuppressionFilter&quot;&gt;
&lt;property name=&quot;file&quot; value=&quot;config/suppressions.xml&quot;/&gt;
&lt;/module&gt;
</source>
<p>
A <a href="config.html#XML_Structure"><em>suppressions XML
document</em></a> contains a set
of <code>suppress</code> elements, where
each <code>suppress</code> element can have the
following attributes:
</p>
<ul>
<li>
<code>files</code> -
a <a href="property_types.html#regexp">regular expression</a>
matched against the file name associated with an audit
event. It is mandatory.
</li>
<li>
<code>checks</code> -
a <a href="property_types.html#regexp">regular expression</a>
matched against the name of the check associated with an audit
event. Optional if <code>id</code> is specified.
</li>
<li>
<code>id</code> -
a <a href="property_types.html#string">string</a>
matched against the ID of the check associated with an audit
event. Optional if <code>checks</code> is specified.
</li>
<li>
<code>lines</code> - a comma-separated list of
values, where each value is
an <a href="property_types.html#integer">integer</a> or a
range of integers denoted by integer-integer. It is optional.
</li>
<li>
<code>columns</code> - a comma-separated list of
values, where each value is
an <a href="property_types.html#integer">integer</a> or a
range of integers denoted by integer-integer. It is optional.
</li>
</ul>
<p>
Each audit event is checked against
each <code>suppress</code> element. It is
suppressed if all specified attributes match against the audit
event.
</p>
<p>
You can download template of empty suppression filter
<a href="files/suppressions_none.xml">here</a>.
</p>
<p>
The following suppressions XML document directs
a <code>SuppressionFilter</code> to
reject <code>JavadocStyleCheck</code> errors for
lines 82 and 108 to 122 of
file <code>AbstractComplexityCheck.java</code>,
and <code>MagicNumberCheck</code> errors for line
221 of file <code>JavadocStyleCheck.java</code>:
</p>
<source>
&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;!DOCTYPE suppressions PUBLIC
&quot;-//Puppy Crawl//DTD Suppressions 1.1//EN&quot;
&quot;http://www.puppycrawl.com/dtds/suppressions_1_1.dtd&quot;&gt;
&lt;suppressions&gt;
&lt;suppress checks=&quot;JavadocStyleCheck&quot;
files=&quot;AbstractComplexityCheck.java&quot;
lines=&quot;82,108-122&quot;/&gt;
&lt;suppress checks=&quot;MagicNumberCheck&quot;
files=&quot;JavadocStyleCheck.java&quot;
lines=&quot;221&quot;/&gt;
&lt;/suppressions&gt;
</source>
<p>
As another example to suppress Check by module id:
</p>
<source>
&lt;module name=&quot;DescendantToken&quot;&gt;
&lt;property name=&quot;id&quot; value=&quot;stringEqual&quot;/&gt;
&lt;property name=&quot;tokens&quot; value=&quot;EQUAL,NOT_EQUAL&quot;/&gt;
&lt;property name=&quot;limitedTokens&quot; value=&quot;STRING_LITERAL&quot;/&gt;
&lt;property name=&quot;maximumNumber&quot; value=&quot;0&quot;/&gt;
&lt;property name=&quot;maximumDepth&quot; value=&quot;1&quot;/&gt;
&lt;/module&gt;
&lt;module name=&quot;DescendantToken&quot;&gt;
&lt;property name=&quot;id&quot; value=&quot;switchNoDefault&quot;/&gt;
&lt;property name=&quot;tokens&quot; value=&quot;LITERAL_SWITCH&quot;/&gt;
&lt;property name=&quot;maximumDepth&quot; value=&quot;2&quot;/&gt;
&lt;property name=&quot;limitedTokens&quot; value=&quot;LITERAL_DEFAULT&quot;/&gt;
&lt;property name=&quot;minimumNumber&quot; value=&quot;1&quot;/&gt;
&lt;/module&gt;
</source>
<p>
Then the following can be used to suppress only the first
check and not the second by using
the <code>id</code> attribute:
</p>
<source>
&lt;suppress id=&quot;stringEqual&quot; files=&quot;SomeTestCode.java&quot;/&gt;
</source>
<p>
Suppress checks for hidden files and folders:
</p>
<source>
&lt;suppress files=&quot;[/\\]\..+&quot; checks=&quot;.*&quot;/&gt;
</source>
<p>
Suppress checks for Maven-generated code:
</p>
<source>
&lt;suppress files=&quot;[/\\]target[/\\]&quot; checks=&quot;.*&quot;/&gt;
</source>
<p>
Suppress checks for archives, classes and other binary files:
</p>
<source>
&lt;suppress files=&quot;.+\.(?:jar|zip|war|class|tar|bin)$&quot; checks=&quot;.*&quot;/&gt;
</source>
<p>
Suppress checks for image files:
</p>
<source>
&lt;suppress files=&quot;.+\.(?:png|gif|jpg|jpeg)$&quot; checks=&quot;.*&quot;/&gt;
</source>
<p>
Suppress checks for non-java files:
</p>
<source>
&lt;suppress files=&quot;.+\.(?:txt|xml|csv|sh|thrift|html|sql|eot|ttf|woff|css|png)$&quot; checks=&quot;.*&quot;/&gt;
</source>
<p>
Suppress all checks in generated sources:
</p>
<source>
&lt;suppress checks=&quot;.*&quot; files=&quot;com[\\/]mycompany[\\/]app[\\/]gen[\\/]&quot;/&gt;
</source>
<p>
Suppress FileLength check on integration tests in certain folder:
</p>
<source>
&lt;suppress checks=&quot;FileLength&quot; files=&quot;com[\\/]mycompany[\\/]app[\\/].*IT.java&quot;/&gt;
</source>
</subsection>
<subsection name="Example of Usage">
<ul>
<li>
<a href="https://github.com/checkstyle/checkstyle/blob/master/config/checkstyle_checks.xml#L21">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Package">
<p> com.puppycrawl.tools.checkstyle.filters </p>
</subsection>
<subsection name="Parent Module">
<p> <a href="config.html#Checker">Checker</a> </p>
</subsection>
</section>
<section name="SuppressWarningsFilter">
<subsection name="Description">
<p>
Filter <code>SuppressWarningsFilter</code> uses annotations to
suppress audit events.
</p>
<p>
Rationale: Same as for
<code>SuppressionCommentFilter</code>. In the contrary to it
here, comments are not used comments but the builtin syntax of
<code>@SuppressWarnings</code>. This can be perceived as a
more elegant solution than using comments. Also this approach
maybe supported by various IDE.
</p>
<p>
Usage: This filter only works in conjunction with a
<a href="config_annotation.html#SuppressWarningsHolder">SuppressWarningsHolder</a>, since that check finds
the annotations in the Java files and makes them available for
the filter. Because of that, a configuration that includes
this filter must also include
<code>SuppressWarningsHolder</code> as a child module of the
<code>TreeWalker</code>. Name of check in annotation is case-insensitive
and should be written with any dotted prefix or "Check" suffix removed.
</p>
</subsection>
<subsection name="Examples">
<p>
To configure the check that makes tha annotations available to
the filter.
</p>
<source>
&lt;module name="TreeWalker"&gt;
...
&lt;module name="SuppressWarningsHolder" /&gt;
...
&lt;/module&gt;
</source>
<p>To configure filter to suppress audit events for annotations add:</p>
<source>
&lt;module name="SuppressWarningsFilter" /&gt;
</source>
<source>
@SuppressWarnings({"memberName"})
private int J; // should NOT fail MemberNameCheck
@SuppressWarnings({"MemberName"})
@SuppressWarnings({"NoWhitespaceAfter"})
private int [] ARRAY; // should NOT fail MemberNameCheck and NoWhitespaceAfterCheck
</source>
</subsection>
<subsection name="Example of Usage">
<ul>
<li>
<a href="https://github.com/checkstyle/checkstyle/blob/master/config/checkstyle_checks.xml#L383">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Package">
<p> com.puppycrawl.tools.checkstyle.filters </p>
</subsection>
<subsection name="Parent Module">
<p> <a href="config.html#Checker">Checker</a> </p>
</subsection>
</section>
<section name="SuppressWithNearbyCommentFilter">
<subsection name="Description">
<p>
@ -740,72 +807,5 @@ public static final int [] array; // @cs.suppress ConstantName | NoWhitespaceAft
<p> <a href="config.html#Checker">Checker</a> </p>
</subsection>
</section>
<section name="SuppressWarningsFilter">
<subsection name="Description">
<p>
Filter <code>SuppressWarningsFilter</code> uses annotations to
suppress audit events.
</p>
<p>
Rationale: Same as for
<code>SuppressionCommentFilter</code>. In the contrary to it
here, comments are not used comments but the builtin syntax of
<code>@SuppressWarnings</code>. This can be perceived as a
more elegant solution than using comments. Also this approach
maybe supported by various IDE.
</p>
<p>
Usage: This filter only works in conjunction with a
<a href="config_annotation.html#SuppressWarningsHolder">SuppressWarningsHolder</a>, since that check finds
the annotations in the Java files and makes them available for
the filter. Because of that, a configuration that includes
this filter must also include
<code>SuppressWarningsHolder</code> as a child module of the
<code>TreeWalker</code>. Name of check in annotation is case-insensitive
and should be written with any dotted prefix or "Check" suffix removed.
</p>
</subsection>
<subsection name="Examples">
<p>
To configure the check that makes tha annotations available to
the filter.
</p>
<source>
&lt;module name="TreeWalker"&gt;
...
&lt;module name="SuppressWarningsHolder" /&gt;
...
&lt;/module&gt;
</source>
<p>To configure filter to suppress audit events for annotations add:</p>
<source>
&lt;module name="SuppressWarningsFilter" /&gt;
</source>
<source>
@SuppressWarnings({"memberName"})
private int J; // should NOT fail MemberNameCheck
@SuppressWarnings({"MemberName"})
@SuppressWarnings({"NoWhitespaceAfter"})
private int [] ARRAY; // should NOT fail MemberNameCheck and NoWhitespaceAfterCheck
</source>
</subsection>
<subsection name="Example of Usage">
<ul>
<li>
<a href="https://github.com/checkstyle/checkstyle/blob/master/config/checkstyle_checks.xml#L383">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Package">
<p> com.puppycrawl.tools.checkstyle.filters </p>
</subsection>
<subsection name="Parent Module">
<p> <a href="config.html#Checker">Checker</a> </p>
</subsection>
</section>
</body>
</document>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -503,6 +503,113 @@ class SwitchExample {
</subsection>
</section>
<section name="JavaNCSS">
<subsection name="Description">
<p>
Determines complexity of methods, classes and files by
counting the Non Commenting Source Statements (NCSS). This
check adheres to the <a
href="http://www.kclee.de/clemens/java/javancss/#specification">
specification</a> for the
<a href="http://www.kclee.de/clemens/java/javancss/">JavaNCSS-Tool</a>
written by <b>Chr. Clemens Lee</b>.<br/>
Roughly said the NCSS metric is calculated by
counting the source lines which are not comments, (nearly)
equivalent to counting the semicolons and opening curly
braces.<br/> The NCSS for a class is summarized from the NCSS
of all its methods, the NCSS of its nested classes and the
number of member variable declarations.<br/> The NCSS for a
file is summarized from the ncss of all its top level classes,
the number of imports and the package declaration.
</p>
<p>
Rationale: Too large methods and classes are hard to read and
costly to maintain. A large NCSS number often means that a
method or class has too many responsibilities and/or
functionalities which should be decomposed into smaller units.
</p>
</subsection>
<subsection name="Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
</tr>
<tr>
<td>methodMaximum</td>
<td>
the maximum allowed number of non commenting lines in a
method.
</td>
<td><a href="property_types.html#integer">integer</a></td>
<td><code>50</code></td>
</tr>
<tr>
<td>classMaximum</td>
<td>
the maximum allowed number of non commenting lines in a
class.
</td>
<td><a href="property_types.html#integer">integer</a></td>
<td><code>1500</code></td>
</tr>
<tr>
<td>fileMaximum</td>
<td>
the maximum allowed number of non commenting lines in a
file including all top level and nested classes.
</td>
<td><a href="property_types.html#integer">integer</a></td>
<td><code>2000</code></td>
</tr>
</table>
</subsection>
<subsection name="Examples">
<p>
To configure the check:
</p>
<source>
&lt;module name=&quot;JavaNCSS&quot;/&gt;
</source>
<p>
To configure the check with 40 allowed non commenting lines
for a method:
</p>
<source>
&lt;module name=&quot;JavaNCSS&quot;&gt;
&lt;property name=&quot;methodMaximum&quot; value=&quot;40&quot;/&gt;
&lt;/module&gt;
</source>
</subsection>
<subsection name="Example of Usage">
<ul>
<li>
<a href="https://github.com/checkstyle/checkstyle/blob/master/config/checkstyle_checks.xml#L322">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Package">
<p>
com.puppycrawl.tools.checkstyle.checks.metrics
</p>
</subsection>
<subsection name="Parent Module">
<p>
<a href="config.html#TreeWalker">TreeWalker</a>
</p>
</subsection>
</section>
<section name="NPathComplexity">
<subsection name="Description">
<p>
@ -662,112 +769,5 @@ class SwitchExample {
</p>
</subsection>
</section>
<section name="JavaNCSS">
<subsection name="Description">
<p>
Determines complexity of methods, classes and files by
counting the Non Commenting Source Statements (NCSS). This
check adheres to the <a
href="http://www.kclee.de/clemens/java/javancss/#specification">
specification</a> for the
<a href="http://www.kclee.de/clemens/java/javancss/">JavaNCSS-Tool</a>
written by <b>Chr. Clemens Lee</b>.<br/>
Roughly said the NCSS metric is calculated by
counting the source lines which are not comments, (nearly)
equivalent to counting the semicolons and opening curly
braces.<br/> The NCSS for a class is summarized from the NCSS
of all its methods, the NCSS of its nested classes and the
number of member variable declarations.<br/> The NCSS for a
file is summarized from the ncss of all its top level classes,
the number of imports and the package declaration.
</p>
<p>
Rationale: Too large methods and classes are hard to read and
costly to maintain. A large NCSS number often means that a
method or class has too many responsibilities and/or
functionalities which should be decomposed into smaller units.
</p>
</subsection>
<subsection name="Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
</tr>
<tr>
<td>methodMaximum</td>
<td>
the maximum allowed number of non commenting lines in a
method.
</td>
<td><a href="property_types.html#integer">integer</a></td>
<td><code>50</code></td>
</tr>
<tr>
<td>classMaximum</td>
<td>
the maximum allowed number of non commenting lines in a
class.
</td>
<td><a href="property_types.html#integer">integer</a></td>
<td><code>1500</code></td>
</tr>
<tr>
<td>fileMaximum</td>
<td>
the maximum allowed number of non commenting lines in a
file including all top level and nested classes.
</td>
<td><a href="property_types.html#integer">integer</a></td>
<td><code>2000</code></td>
</tr>
</table>
</subsection>
<subsection name="Examples">
<p>
To configure the check:
</p>
<source>
&lt;module name=&quot;JavaNCSS&quot;/&gt;
</source>
<p>
To configure the check with 40 allowed non commenting lines
for a method:
</p>
<source>
&lt;module name=&quot;JavaNCSS&quot;&gt;
&lt;property name=&quot;methodMaximum&quot; value=&quot;40&quot;/&gt;
&lt;/module&gt;
</source>
</subsection>
<subsection name="Example of Usage">
<ul>
<li>
<a href="https://github.com/checkstyle/checkstyle/blob/master/config/checkstyle_checks.xml#L322">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Package">
<p>
com.puppycrawl.tools.checkstyle.checks.metrics
</p>
</subsection>
<subsection name="Parent Module">
<p>
<a href="config.html#TreeWalker">TreeWalker</a>
</p>
</subsection>
</section>
</body>
</document>

File diff suppressed because it is too large Load Diff

View File

@ -459,6 +459,105 @@
</subsection>
</section>
<section name="RegexpMultiline">
<subsection name="Description">
<p>
A check for detecting that matches across multiple lines.
Works with any file type.
</p>
<p>
Rationale: This check can be used to when the regular
expression can be span multiple lines.
</p>
</subsection>
<subsection name="Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
</tr>
<tr>
<td>format</td>
<td>illegal pattern</td>
<td><a href="property_types.html#regexp">regular expression</a></td>
<td><code>^$</code> (empty)</td>
</tr>
<tr>
<td>message</td>
<td>message which is used to notify about violations,
if empty then default(hard-coded) message is used.</td>
<td><a href="property_types.html#string">String</a></td>
<td><code>&quot;&quot;</code>(empty)</td>
</tr>
<tr>
<td>ignoreCase</td>
<td>Controls whether to ignore case when searching.</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>false</code></td>
</tr>
<tr>
<td>minimum</td>
<td>The minimum number of matches required in each file.</td>
<td><a href="property_types.html#integer">Integer</a></td>
<td><code>0</code></td>
</tr>
<tr>
<td>maximum</td>
<td>The maximum number of matches required in each file.</td>
<td><a href="property_types.html#integer">Integer</a></td>
<td><code>0</code></td>
</tr>
<tr>
<td>fileExtensions</td>
<td>file type extension of files to process</td>
<td><a href="property_types.html#stringSet">String Set</a></td>
<td><code>{}</code></td>
</tr>
</table>
</subsection>
<subsection name="Examples">
<p>
To configure the check to find calls to print to the console:
</p>
<source>
&lt;module name=&quot;RegexpMultiline&quot;&gt;
&lt;property name=&quot;format&quot;
value=&quot;System\.(out)|(err)\.print(ln)?\(&quot;/&gt;
&lt;/module&gt;
</source>
</subsection>
<subsection name="Example of Usage">
<ul>
<li>
<a href="https://github.com/checkstyle/checkstyle/blob/master/config/checkstyle_checks.xml#L51-L56">
Checkstyle Style</a>
</li>
<li>
<a href="https://github.com/checkstyle/checkstyle/blob/master/config/checkstyle_checks.xml#L63-L67">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Package">
<p>
com.puppycrawl.tools.checkstyle.checks.regexp
</p>
</subsection>
<subsection name="Parent Module">
<p>
<a href="config.html#Checker">Checker</a>
</p>
</subsection>
</section>
<section name="RegexpSingleline">
<subsection name="Description">
<p>
@ -591,105 +690,6 @@
</subsection>
</section>
<section name="RegexpMultiline">
<subsection name="Description">
<p>
A check for detecting that matches across multiple lines.
Works with any file type.
</p>
<p>
Rationale: This check can be used to when the regular
expression can be span multiple lines.
</p>
</subsection>
<subsection name="Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
</tr>
<tr>
<td>format</td>
<td>illegal pattern</td>
<td><a href="property_types.html#regexp">regular expression</a></td>
<td><code>^$</code> (empty)</td>
</tr>
<tr>
<td>message</td>
<td>message which is used to notify about violations,
if empty then default(hard-coded) message is used.</td>
<td><a href="property_types.html#string">String</a></td>
<td><code>&quot;&quot;</code>(empty)</td>
</tr>
<tr>
<td>ignoreCase</td>
<td>Controls whether to ignore case when searching.</td>
<td><a href="property_types.html#boolean">Boolean</a></td>
<td><code>false</code></td>
</tr>
<tr>
<td>minimum</td>
<td>The minimum number of matches required in each file.</td>
<td><a href="property_types.html#integer">Integer</a></td>
<td><code>0</code></td>
</tr>
<tr>
<td>maximum</td>
<td>The maximum number of matches required in each file.</td>
<td><a href="property_types.html#integer">Integer</a></td>
<td><code>0</code></td>
</tr>
<tr>
<td>fileExtensions</td>
<td>file type extension of files to process</td>
<td><a href="property_types.html#stringSet">String Set</a></td>
<td><code>{}</code></td>
</tr>
</table>
</subsection>
<subsection name="Examples">
<p>
To configure the check to find calls to print to the console:
</p>
<source>
&lt;module name=&quot;RegexpMultiline&quot;&gt;
&lt;property name=&quot;format&quot;
value=&quot;System\.(out)|(err)\.print(ln)?\(&quot;/&gt;
&lt;/module&gt;
</source>
</subsection>
<subsection name="Example of Usage">
<ul>
<li>
<a href="https://github.com/checkstyle/checkstyle/blob/master/config/checkstyle_checks.xml#L51-L56">
Checkstyle Style</a>
</li>
<li>
<a href="https://github.com/checkstyle/checkstyle/blob/master/config/checkstyle_checks.xml#L63-L67">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Package">
<p>
com.puppycrawl.tools.checkstyle.checks.regexp
</p>
</subsection>
<subsection name="Parent Module">
<p>
<a href="config.html#Checker">Checker</a>
</p>
</subsection>
</section>
<section name="RegexpSinglelineJava">
<subsection name="Description">
<p>

View File

@ -21,6 +21,71 @@
</macro>
</section>
<section name="AnonInnerLength">
<subsection name="Description">
<p>
Checks for long anonymous inner classes.
</p>
<p>
Rationale: If an anonymous inner class becomes very long it is hard
to understand and to see the flow of the method where the class is
defined. Therefore long anonymous inner classes should usually be
refactored into a named inner class. See also Bloch, Effective
Java, p. 93.
</p>
</subsection>
<subsection name="Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
</tr>
<tr>
<td>max</td>
<td>maximum allowable number of lines</td>
<td><a href="property_types.html#integer">integer</a></td>
<td>20</td>
</tr>
</table>
</subsection>
<subsection name="Examples">
<p>
To configure the check to accept files with up to 60 lines:
</p>
<source>
&lt;module name="AnonInnerLength"&gt;
&lt;property name="max" value="60"/&gt;
&lt;/module&gt;
</source>
</subsection>
<subsection name="Example of Usage">
<ul>
<li>
<a href="https://github.com/checkstyle/checkstyle/blob/master/config/checkstyle_checks.xml#L240">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Package">
<p>
com.puppycrawl.tools.checkstyle.checks.sizes
</p>
</subsection>
<subsection name="Parent Module">
<p>
<a href="config.html#TreeWalker">TreeWalker</a>
</p>
</subsection>
</section>
<section name="ExecutableStatementCount">
<subsection name="Description">
<p>
@ -281,6 +346,118 @@
</subsection>
</section>
<section name="MethodCount">
<subsection name="Description">
<p>
Checks the number of methods declared in each type. This
includes the number of each scope (<code>private</code>,
<code>package</code>, <code>protected</code> and
<code>public</code>) as well as an overall total.
</p>
</subsection>
<subsection name="Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
</tr>
<tr>
<td>maxTotal</td>
<td>maximum allowable number of methods at all scope levels</td>
<td><a href="property_types.html#integer">integer</a></td>
<td>100</td>
</tr>
<tr>
<td>maxPrivate</td>
<td>maximum allowable number of <code>private</code> methods</td>
<td><a href="property_types.html#integer">integer</a></td>
<td>100</td>
</tr>
<tr>
<td>maxPackage</td>
<td>maximum allowable number of <code>package</code> methods</td>
<td><a href="property_types.html#integer">integer</a></td>
<td>100</td>
</tr>
<tr>
<td>maxProtected</td>
<td>maximum allowable number of <code>protected</code> methods</td>
<td><a href="property_types.html#integer">integer</a></td>
<td>100</td>
</tr>
<tr>
<td>maxPublic</td>
<td>maximum allowable number of <code>public</code> methods</td>
<td><a href="property_types.html#integer">integer</a></td>
<td>100</td>
</tr>
<tr>
<td>tokens</td>
<td>tokens to check</td>
<td>
subset of tokens
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#CLASS_DEF">CLASS_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ENUM_CONSTANT_DEF">ENUM_CONSTANT_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ENUM_DEF">ENUM_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#INTERFACE_DEF">INTERFACE_DEF</a>.
</td>
<td>
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#CLASS_DEF">CLASS_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ENUM_CONSTANT_DEF">ENUM_CONSTANT_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ENUM_DEF">ENUM_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#INTERFACE_DEF">INTERFACE_DEF</a>.
</td>
</tr>
</table>
</subsection>
<subsection name="Examples">
<p>
To configure the check with defaults:
</p>
<source>
&lt;module name="MethodCount"/&gt;
</source>
<p>
To configure the check to allow at most 30 methods per type:
</p>
<source>
&lt;module name="MethodCount"&gt;
&lt;property name="maxTotal" value="30"/&gt;
&lt;/module&gt;
</source>
</subsection>
<subsection name="Example of Usage">
<ul>
<li>
<a href="https://github.com/checkstyle/checkstyle/blob/master/config/checkstyle_checks.xml#L130-L132">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Package">
<p>
com.puppycrawl.tools.checkstyle.checks.sizes
</p>
</subsection>
<subsection name="Parent Module">
<p>
<a href="config.html#TreeWalker">TreeWalker</a>
</p>
</subsection>
</section>
<section name="MethodLength">
<subsection name="Description">
<p>
@ -396,18 +573,16 @@
</subsection>
</section>
<section name="AnonInnerLength">
<section name="OuterTypeNumber">
<subsection name="Description">
<p>
Checks for long anonymous inner classes.
Checks for the number of types declared at the <i>outer</i>
(or <i>root</i>) level in a file.
</p>
<p>
Rationale: If an anonymous inner class becomes very long it is hard
to understand and to see the flow of the method where the class is
defined. Therefore long anonymous inner classes should usually be
refactored into a named inner class. See also Bloch, Effective
Java, p. 93.
Rationale: It is considered good practice to only define one outer
type per file.
</p>
</subsection>
@ -421,28 +596,36 @@
</tr>
<tr>
<td>max</td>
<td>maximum allowable number of lines</td>
<td>maximum allowable number of outer types</td>
<td><a href="property_types.html#integer">integer</a></td>
<td>20</td>
<td>1</td>
</tr>
</table>
</subsection>
<subsection name="Examples">
<p>
To configure the check to accept files with up to 60 lines:
To configure the check to accept 1 outer type per file:
</p>
<source>
&lt;module name="AnonInnerLength"&gt;
&lt;property name="max" value="60"/&gt;
&lt;module name="OuterTypeNumber"/&gt;
</source>
<p>
To configure the check to accept 2 outer types per file:
</p>
<source>
&lt;module name="OuterTypeNumber"&gt;
&lt;property name="max" value="2"/&gt;
&lt;/module&gt;
</source>
</subsection>
<subsection name="Example of Usage">
<ul>
<li>
<a href="https://github.com/checkstyle/checkstyle/blob/master/config/checkstyle_checks.xml#L240">
<a href="https://github.com/checkstyle/checkstyle/blob/master/config/checkstyle_checks.xml#L125">
Checkstyle Style</a>
</li>
</ul>
@ -576,188 +759,5 @@ public void needsLotsOfParameters(int a, int b, int c, int d, int e, int f, int
</subsection>
</section>
<section name="OuterTypeNumber">
<subsection name="Description">
<p>
Checks for the number of types declared at the <i>outer</i>
(or <i>root</i>) level in a file.
</p>
<p>
Rationale: It is considered good practice to only define one outer
type per file.
</p>
</subsection>
<subsection name="Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
</tr>
<tr>
<td>max</td>
<td>maximum allowable number of outer types</td>
<td><a href="property_types.html#integer">integer</a></td>
<td>1</td>
</tr>
</table>
</subsection>
<subsection name="Examples">
<p>
To configure the check to accept 1 outer type per file:
</p>
<source>
&lt;module name="OuterTypeNumber"/&gt;
</source>
<p>
To configure the check to accept 2 outer types per file:
</p>
<source>
&lt;module name="OuterTypeNumber"&gt;
&lt;property name="max" value="2"/&gt;
&lt;/module&gt;
</source>
</subsection>
<subsection name="Example of Usage">
<ul>
<li>
<a href="https://github.com/checkstyle/checkstyle/blob/master/config/checkstyle_checks.xml#L125">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Package">
<p>
com.puppycrawl.tools.checkstyle.checks.sizes
</p>
</subsection>
<subsection name="Parent Module">
<p>
<a href="config.html#TreeWalker">TreeWalker</a>
</p>
</subsection>
</section>
<section name="MethodCount">
<subsection name="Description">
<p>
Checks the number of methods declared in each type. This
includes the number of each scope (<code>private</code>,
<code>package</code>, <code>protected</code> and
<code>public</code>) as well as an overall total.
</p>
</subsection>
<subsection name="Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
</tr>
<tr>
<td>maxTotal</td>
<td>maximum allowable number of methods at all scope levels</td>
<td><a href="property_types.html#integer">integer</a></td>
<td>100</td>
</tr>
<tr>
<td>maxPrivate</td>
<td>maximum allowable number of <code>private</code> methods</td>
<td><a href="property_types.html#integer">integer</a></td>
<td>100</td>
</tr>
<tr>
<td>maxPackage</td>
<td>maximum allowable number of <code>package</code> methods</td>
<td><a href="property_types.html#integer">integer</a></td>
<td>100</td>
</tr>
<tr>
<td>maxProtected</td>
<td>maximum allowable number of <code>protected</code> methods</td>
<td><a href="property_types.html#integer">integer</a></td>
<td>100</td>
</tr>
<tr>
<td>maxPublic</td>
<td>maximum allowable number of <code>public</code> methods</td>
<td><a href="property_types.html#integer">integer</a></td>
<td>100</td>
</tr>
<tr>
<td>tokens</td>
<td>tokens to check</td>
<td>
subset of tokens
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#CLASS_DEF">CLASS_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ENUM_CONSTANT_DEF">ENUM_CONSTANT_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ENUM_DEF">ENUM_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#INTERFACE_DEF">INTERFACE_DEF</a>.
</td>
<td>
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#CLASS_DEF">CLASS_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ENUM_CONSTANT_DEF">ENUM_CONSTANT_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ENUM_DEF">ENUM_DEF</a>,
<a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#INTERFACE_DEF">INTERFACE_DEF</a>.
</td>
</tr>
</table>
</subsection>
<subsection name="Examples">
<p>
To configure the check with defaults:
</p>
<source>
&lt;module name="MethodCount"/&gt;
</source>
<p>
To configure the check to allow at most 30 methods per type:
</p>
<source>
&lt;module name="MethodCount"&gt;
&lt;property name="maxTotal" value="30"/&gt;
&lt;/module&gt;
</source>
</subsection>
<subsection name="Example of Usage">
<ul>
<li>
<a href="https://github.com/checkstyle/checkstyle/blob/master/config/checkstyle_checks.xml#L130-L132">
Checkstyle Style</a>
</li>
</ul>
</subsection>
<subsection name="Package">
<p>
com.puppycrawl.tools.checkstyle.checks.sizes
</p>
</subsection>
<subsection name="Parent Module">
<p>
<a href="config.html#TreeWalker">TreeWalker</a>
</p>
</subsection>
</section>
</body>
</document>

File diff suppressed because it is too large Load Diff