checkstyle/src/xdocs/config_usage.xml

360 lines
10 KiB
XML
Executable File

<?xml version="1.0" encoding="ISO-8859-1"?>
<document>
<properties>
<title>Usage Checks</title>
<author email="checkstyle-devel@lists.sourceforge.net">Checkstyle Development Team</author>
</properties>
<body>
<section name="OneMethodPrivateField">
<subsection name="Description">
<p>
Checks that a private field is used in more than one method,
constructor, or initializer.
</p>
<p>
Rationale: a private field used in only one method,
constructor, or initializer should be replaced by a local
variable.
</p>
</subsection>
<subsection name="Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
</tr>
<tr>
<td>ignoreFormat</td>
<td>pattern for field names that should be ignored</td>
<td>
<a href="property_types.html#regexp">regular expression</a>
</td>
<td><span class="default">^$</span> (empty)</td>
</tr>
</table>
</subsection>
<subsection name="Examples">
<p>
To configure the check:
</p>
<source>
&lt;module name=&quot;usage.OneMethodPrivateField&quot;/&gt;
</source>
<p>
To configure the check to ignore fields whose name ends in
<span class="code">Temp</span>:
</p>
<source>
&lt;module name=&quot;usage.OneMethodPrivateField&quot;&gt;
&lt;property name=&quot;ignoreFormat&quot; value=&quot;Temp$&quot;/&gt;
&lt;/module&gt;
</source>
</subsection>
<subsection name="Package">
<p>
com.puppycrawl.tools.checkstyle.checks.usage
</p>
</subsection>
<subsection name="Parent Module">
<p>
<a href="config.html#treewalker">TreeWalker</a>
</p>
</subsection>
</section>
<section name="UnusedLocalVariable">
<subsection name="Description">
<p>
Checks that a local variable is used after its declaration.
</p>
</subsection>
<subsection name="Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
</tr>
<tr>
<td>ignoreFormat</td>
<td>pattern for variable names that should be ignored</td>
<td>
<a href="property_types.html#regexp">regular expression</a>
</td>
<td><span class="default">^$</span> (empty)</td>
</tr>
</table>
</subsection>
<subsection name="Examples">
<p>
To configure the check:
</p>
<source>
&lt;module name=&quot;usage.UnusedLocalVariable&quot;/&gt;
</source>
<p>
To configure the check to ignore variables whose name ends
in <span class="code">Temp</span>:
</p>
<source>
&lt;module name=&quot;usage.UnusedLocalVariable&quot;&gt;
&lt;property name=&quot;ignoreFormat&quot; value=&quot;Temp$&quot;/&gt;
&lt;/module&gt;
</source>
</subsection>
<subsection name="Package">
<p>
com.puppycrawl.tools.checkstyle.checks.usage
</p>
</subsection>
<subsection name="Parent Module">
<p>
<a href="config.html#treewalker">TreeWalker</a>
</p>
</subsection>
</section>
<section name="UnusedParameter">
<subsection name="Description">
<p>
Checks that a parameter is used.
</p>
</subsection>
<subsection name="Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
</tr>
<tr>
<td>ignoreFormat</td>
<td>pattern for parameter names that should be ignored</td>
<td>
<a href="property_types.html#regexp">regular expression</a>
</td>
<td><span class="default">^$</span> (empty)</td>
</tr>
<tr>
<td>ignoreCatch</td>
<td>
controls whether <span class="code">catch</span>
parameters should be ignored
</td>
<td><a href="property_types.html#boolean">boolean</a></td>
<td><span class="default">true</span></td>
</tr>
<tr>
<td>ignoreNonLocal</td>
<td>
controls whether parameters of non local (<span
class="code">public, protected or package</span>)
methods should be ignored
</td>
<td><a href="property_types.html#boolean">boolean</a></td>
<td><span class="default">false</span></td>
</tr>
</table>
</subsection>
<subsection name="Examples">
<p>
To configure the check:
</p>
<source>
&lt;module name=&quot;usage.UnusedParameter&quot;/&gt;
</source>
<p>
To configure the check to ignore parameters whose name ends
in <span class="code">Temp</span>:
</p>
<source>
&lt;module name=&quot;usage.UnusedParameter&quot;&gt;
&lt;property name=&quot;ignoreFormat&quot; value=&quot;Temp$&quot;/&gt;
&lt;/module&gt;
</source>
<p>
To configure the check to report unused <span
class="code">catch</span> parameters:
</p>
<source>
&lt;module name=&quot;usage.UnusedParameter&quot;&gt;
&lt;property name=&quot;ignoreCatch&quot; value=&quot;false&quot;/&gt;
&lt;/module&gt;
</source>
</subsection>
<subsection name="Package">
<p>
com.puppycrawl.tools.checkstyle.checks.usage
</p>
</subsection>
<subsection name="Parent Module">
<p>
<a href="config.html#treewalker">TreeWalker</a>
</p>
</subsection>
</section>
<section name="UnusedPrivateField">
<subsection name="Description">
<p>
Checks that a private field is used.
</p>
</subsection>
<subsection name="Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
</tr>
<tr>
<td>ignoreFormat</td>
<td>pattern for field names that should be ignored</td>
<td>
<a href="property_types.html#regexp">regular expression</a>
</td>
<td><span class="default">^$</span> (empty)</td>
</tr>
</table>
</subsection>
<subsection name="Examples">
<p>
To configure the check:
</p>
<source>
&lt;module name=&quot;usage.UnusedPrivateField&quot;/&gt;
</source>
<p>
To configure the check to ignore fields whose name ends in
<span class="code">Temp</span>:
</p>
<source>
&lt;module name=&quot;usage.UnusedPrivateField&quot;&gt;
&lt;property name=&quot;ignoreFormat&quot; value=&quot;Temp$&quot;/&gt;
&lt;/module&gt;
</source>
</subsection>
<subsection name="Package">
<p>
com.puppycrawl.tools.checkstyle.checks.usage
</p>
</subsection>
<subsection name="Parent Module">
<p>
<a href="config.html#treewalker">TreeWalker</a>
</p>
</subsection>
</section>
<section name="UnusedPrivateMethod">
<subsection name="Description">
<p>
Checks that a private method is used.
</p>
</subsection>
<subsection name="Properties">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
</tr>
<tr>
<td>ignoreFormat</td>
<td>pattern for method names that should be ignored</td>
<td>
<a href="property_types.html#regexp">regular expression</a>
</td>
<td><span class="default">^$</span> (empty)</td>
</tr>
<tr>
<td>allowSerializationMethods</td>
<td>whether the check should allow serialization-related methods
(<span class="code">readObject()</span>, <span
class="code">writeObject()</span>, <span
class="code">readResolve()</span> and <span
class="code">writeReplace()</span></td>
<td>
<a href="property_types.html#boolean">boolean</a>
</td>
<td><span class="default">false</span></td>
</tr>
</table>
</subsection>
<subsection name="Examples">
<p>
To configure the check:
</p>
<source>
&lt;module name=&quot;usage.UnusedPrivateMethod&quot;/&gt;
</source>
<p>
To configure the check to ignore methods whose name ends in
<span class="code">Temp</span>:
</p>
<source>
&lt;module name=&quot;usage.UnusedPrivateMethod&quot;&gt;
&lt;property name=&quot;ignoreFormat&quot; value=&quot;Temp$&quot;/&gt;
&lt;/module&gt;
</source>
</subsection>
<subsection name="Notes">
<ul>
<li>
The classpath may need to be configured to locate
parameter type information. The classpath configuration is
dependent on the mechanism used to invoke Checkstyle.
</li>
</ul>
</subsection>
<subsection name="Package">
<p>
com.puppycrawl.tools.checkstyle.checks.usage
</p>
</subsection>
<subsection name="Parent Module">
<p>
<a href="config.html#treewalker">TreeWalker</a>
</p>
</subsection>
</section>
</body>
</document>