Issue #2292: fixed xdoc check order errors
This commit is contained in:
parent
e5d5133195
commit
879738dc84
|
|
@ -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>
|
||||
<module name="AnnotationLocation">
|
||||
<property name="allowSamelineMultipleAnnotations" value="false"/>
|
||||
<property name="allowSamelineSingleParameterlessAnnotation" value="true"/>
|
||||
<property name="allowSamelineParameterizedAnnotation" value="false"/>
|
||||
</module>
|
||||
</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>
|
||||
<module name="AnnotationLocation">
|
||||
<property name="allowSamelineMultipleAnnotations" value="true"/>
|
||||
<property name="allowSamelineSingleParameterlessAnnotation" value="true"/>
|
||||
<property name="allowSamelineParameterizedAnnotation" value="true"/>
|
||||
</module>
|
||||
</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>
|
||||
<module name="AnnotationLocation">
|
||||
<property name="allowSamelineMultipleAnnotations" value="true"/>
|
||||
<property name="allowSamelineSingleParameterlessAnnotation" value="true"/>
|
||||
<property name="allowSamelineParameterizedAnnotation" value="false"/>
|
||||
</module>
|
||||
</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>
|
||||
<module name="AnnotationLocation">
|
||||
<property name="allowSamelineMultipleAnnotations" value="false"/>
|
||||
<property name="allowSamelineSingleParameterlessAnnotation" value="true"/>
|
||||
<property name="allowSamelineParameterizedAnnotation" value="false"/>
|
||||
</module>
|
||||
</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>
|
||||
<module name="AnnotationLocation">
|
||||
<property name="allowSamelineMultipleAnnotations" value="true"/>
|
||||
<property name="allowSamelineSingleParameterlessAnnotation" value="true"/>
|
||||
<property name="allowSamelineParameterizedAnnotation" value="true"/>
|
||||
</module>
|
||||
</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>
|
||||
<module name="AnnotationLocation">
|
||||
<property name="allowSamelineMultipleAnnotations" value="true"/>
|
||||
<property name="allowSamelineSingleParameterlessAnnotation" value="true"/>
|
||||
<property name="allowSamelineParameterizedAnnotation" value="false"/>
|
||||
</module>
|
||||
</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>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
<module name="AvoidNestedBlocks"/>
|
||||
</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>
|
||||
<module name="AvoidNestedBlocks"/>
|
||||
</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
|
|
@ -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>
|
||||
<module name="SuppressionFilter">
|
||||
<property name="file" value="config/suppressions.xml"/>
|
||||
</module>
|
||||
</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>
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!DOCTYPE suppressions PUBLIC
|
||||
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
|
||||
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
|
||||
|
||||
<suppressions>
|
||||
<suppress checks="JavadocStyleCheck"
|
||||
files="AbstractComplexityCheck.java"
|
||||
lines="82,108-122"/>
|
||||
<suppress checks="MagicNumberCheck"
|
||||
files="JavadocStyleCheck.java"
|
||||
lines="221"/>
|
||||
</suppressions>
|
||||
</source>
|
||||
<p>
|
||||
As another example to suppress Check by module id:
|
||||
</p>
|
||||
<source>
|
||||
<module name="DescendantToken">
|
||||
<property name="id" value="stringEqual"/>
|
||||
<property name="tokens" value="EQUAL,NOT_EQUAL"/>
|
||||
<property name="limitedTokens" value="STRING_LITERAL"/>
|
||||
<property name="maximumNumber" value="0"/>
|
||||
<property name="maximumDepth" value="1"/>
|
||||
</module>
|
||||
|
||||
<module name="DescendantToken">
|
||||
<property name="id" value="switchNoDefault"/>
|
||||
<property name="tokens" value="LITERAL_SWITCH"/>
|
||||
<property name="maximumDepth" value="2"/>
|
||||
<property name="limitedTokens" value="LITERAL_DEFAULT"/>
|
||||
<property name="minimumNumber" value="1"/>
|
||||
</module>
|
||||
</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>
|
||||
<suppress id="stringEqual" files="SomeTestCode.java"/>
|
||||
</source>
|
||||
<p>
|
||||
Suppress checks for hidden files and folders:
|
||||
</p>
|
||||
<source>
|
||||
<suppress files="[/\\]\..+" checks=".*"/>
|
||||
</source>
|
||||
<p>
|
||||
Suppress checks for Maven-generated code:
|
||||
</p>
|
||||
<source>
|
||||
<suppress files="[/\\]target[/\\]" checks=".*"/>
|
||||
</source>
|
||||
<p>
|
||||
Suppress checks for archives, classes and other binary files:
|
||||
</p>
|
||||
<source>
|
||||
<suppress files=".+\.(?:jar|zip|war|class|tar|bin)$" checks=".*"/>
|
||||
</source>
|
||||
<p>
|
||||
Suppress checks for image files:
|
||||
</p>
|
||||
<source>
|
||||
<suppress files=".+\.(?:png|gif|jpg|jpeg)$" checks=".*"/>
|
||||
</source>
|
||||
<p>
|
||||
Suppress checks for non-java files:
|
||||
</p>
|
||||
<source>
|
||||
<suppress files=".+\.(?:txt|xml|csv|sh|thrift|html|sql|eot|ttf|woff|css|png)$" checks=".*"/>
|
||||
</source>
|
||||
<p>
|
||||
Suppress all checks in generated sources:
|
||||
</p>
|
||||
<source>
|
||||
<suppress checks=".*" files="com[\\/]mycompany[\\/]app[\\/]gen[\\/]"/>
|
||||
</source>
|
||||
<p>
|
||||
Suppress FileLength check on integration tests in certain folder:
|
||||
</p>
|
||||
<source>
|
||||
<suppress checks="FileLength" files="com[\\/]mycompany[\\/]app[\\/].*IT.java"/>
|
||||
</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>
|
||||
<module name="SuppressionFilter">
|
||||
<property name="file" value="config/suppressions.xml"/>
|
||||
</module>
|
||||
</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>
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!DOCTYPE suppressions PUBLIC
|
||||
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
|
||||
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
|
||||
|
||||
<suppressions>
|
||||
<suppress checks="JavadocStyleCheck"
|
||||
files="AbstractComplexityCheck.java"
|
||||
lines="82,108-122"/>
|
||||
<suppress checks="MagicNumberCheck"
|
||||
files="JavadocStyleCheck.java"
|
||||
lines="221"/>
|
||||
</suppressions>
|
||||
</source>
|
||||
<p>
|
||||
As another example to suppress Check by module id:
|
||||
</p>
|
||||
<source>
|
||||
<module name="DescendantToken">
|
||||
<property name="id" value="stringEqual"/>
|
||||
<property name="tokens" value="EQUAL,NOT_EQUAL"/>
|
||||
<property name="limitedTokens" value="STRING_LITERAL"/>
|
||||
<property name="maximumNumber" value="0"/>
|
||||
<property name="maximumDepth" value="1"/>
|
||||
</module>
|
||||
|
||||
<module name="DescendantToken">
|
||||
<property name="id" value="switchNoDefault"/>
|
||||
<property name="tokens" value="LITERAL_SWITCH"/>
|
||||
<property name="maximumDepth" value="2"/>
|
||||
<property name="limitedTokens" value="LITERAL_DEFAULT"/>
|
||||
<property name="minimumNumber" value="1"/>
|
||||
</module>
|
||||
</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>
|
||||
<suppress id="stringEqual" files="SomeTestCode.java"/>
|
||||
</source>
|
||||
<p>
|
||||
Suppress checks for hidden files and folders:
|
||||
</p>
|
||||
<source>
|
||||
<suppress files="[/\\]\..+" checks=".*"/>
|
||||
</source>
|
||||
<p>
|
||||
Suppress checks for Maven-generated code:
|
||||
</p>
|
||||
<source>
|
||||
<suppress files="[/\\]target[/\\]" checks=".*"/>
|
||||
</source>
|
||||
<p>
|
||||
Suppress checks for archives, classes and other binary files:
|
||||
</p>
|
||||
<source>
|
||||
<suppress files=".+\.(?:jar|zip|war|class|tar|bin)$" checks=".*"/>
|
||||
</source>
|
||||
<p>
|
||||
Suppress checks for image files:
|
||||
</p>
|
||||
<source>
|
||||
<suppress files=".+\.(?:png|gif|jpg|jpeg)$" checks=".*"/>
|
||||
</source>
|
||||
<p>
|
||||
Suppress checks for non-java files:
|
||||
</p>
|
||||
<source>
|
||||
<suppress files=".+\.(?:txt|xml|csv|sh|thrift|html|sql|eot|ttf|woff|css|png)$" checks=".*"/>
|
||||
</source>
|
||||
<p>
|
||||
Suppress all checks in generated sources:
|
||||
</p>
|
||||
<source>
|
||||
<suppress checks=".*" files="com[\\/]mycompany[\\/]app[\\/]gen[\\/]"/>
|
||||
</source>
|
||||
<p>
|
||||
Suppress FileLength check on integration tests in certain folder:
|
||||
</p>
|
||||
<source>
|
||||
<suppress checks="FileLength" files="com[\\/]mycompany[\\/]app[\\/].*IT.java"/>
|
||||
</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>
|
||||
<module name="TreeWalker">
|
||||
...
|
||||
<module name="SuppressWarningsHolder" />
|
||||
...
|
||||
</module>
|
||||
</source>
|
||||
<p>To configure filter to suppress audit events for annotations add:</p>
|
||||
<source>
|
||||
<module name="SuppressWarningsFilter" />
|
||||
</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>
|
||||
<module name="TreeWalker">
|
||||
...
|
||||
<module name="SuppressWarningsHolder" />
|
||||
...
|
||||
</module>
|
||||
</source>
|
||||
<p>To configure filter to suppress audit events for annotations add:</p>
|
||||
<source>
|
||||
<module name="SuppressWarningsFilter" />
|
||||
</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
|
|
@ -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>
|
||||
<module name="JavaNCSS"/>
|
||||
</source>
|
||||
|
||||
<p>
|
||||
To configure the check with 40 allowed non commenting lines
|
||||
for a method:
|
||||
</p>
|
||||
<source>
|
||||
<module name="JavaNCSS">
|
||||
<property name="methodMaximum" value="40"/>
|
||||
</module>
|
||||
</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>
|
||||
<module name="JavaNCSS"/>
|
||||
</source>
|
||||
|
||||
<p>
|
||||
To configure the check with 40 allowed non commenting lines
|
||||
for a method:
|
||||
</p>
|
||||
<source>
|
||||
<module name="JavaNCSS">
|
||||
<property name="methodMaximum" value="40"/>
|
||||
</module>
|
||||
</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
|
|
@ -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>""</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>
|
||||
<module name="RegexpMultiline">
|
||||
<property name="format"
|
||||
value="System\.(out)|(err)\.print(ln)?\("/>
|
||||
</module>
|
||||
</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>""</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>
|
||||
<module name="RegexpMultiline">
|
||||
<property name="format"
|
||||
value="System\.(out)|(err)\.print(ln)?\("/>
|
||||
</module>
|
||||
</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>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
<module name="AnonInnerLength">
|
||||
<property name="max" value="60"/>
|
||||
</module>
|
||||
</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>
|
||||
<module name="MethodCount"/>
|
||||
</source>
|
||||
|
||||
<p>
|
||||
To configure the check to allow at most 30 methods per type:
|
||||
</p>
|
||||
<source>
|
||||
<module name="MethodCount">
|
||||
<property name="maxTotal" value="30"/>
|
||||
</module>
|
||||
</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>
|
||||
<module name="AnonInnerLength">
|
||||
<property name="max" value="60"/>
|
||||
<module name="OuterTypeNumber"/>
|
||||
</source>
|
||||
|
||||
<p>
|
||||
To configure the check to accept 2 outer types per file:
|
||||
</p>
|
||||
<source>
|
||||
<module name="OuterTypeNumber">
|
||||
<property name="max" value="2"/>
|
||||
</module>
|
||||
</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>
|
||||
<module name="OuterTypeNumber"/>
|
||||
</source>
|
||||
|
||||
<p>
|
||||
To configure the check to accept 2 outer types per file:
|
||||
</p>
|
||||
<source>
|
||||
<module name="OuterTypeNumber">
|
||||
<property name="max" value="2"/>
|
||||
</module>
|
||||
</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>
|
||||
<module name="MethodCount"/>
|
||||
</source>
|
||||
|
||||
<p>
|
||||
To configure the check to allow at most 30 methods per type:
|
||||
</p>
|
||||
<source>
|
||||
<module name="MethodCount">
|
||||
<property name="maxTotal" value="30"/>
|
||||
</module>
|
||||
</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
Loading…
Reference in New Issue