checkstyle/docs/config_usage.html

329 lines
9.8 KiB
HTML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Checks for usage</title>
<link rel="stylesheet" type="text/css" href="mystyle.css"/>
</head>
<body>
<!-- The header -->
<table border="0" width="100%" summary="header layout">
<tr>
<td><h1>Checks for usage</h1></td>
<td align="right"><img src="logo.png" alt="Checkstyle Logo"/></td>
</tr>
</table>
<!-- content -->
<table border="0" width="100%" cellpadding="5" summary="body layout">
<tr>
<!--Left menu-->
<td class="menu" valign="top">
<ul>
<li>
<a href="#OneMethodPrivateField">OneMethodPrivateField</a>
</li>
<li>
<a href="#UnusedLocalVariable">UnusedLocalVariable</a>
</li>
<li>
<a href="#UnusedParameter">UnusedParameter</a>
</li>
<li>
<a href="#UnusedPrivateField">UnusedPrivateField</a>
</li>
<li>
<a href="#UnusedPrivateMethod">UnusedPrivateMethod</a>
</li>
</ul>
</td>
<!--Content-->
<td class="content" valign="top" align="left">
<a name="OneMethodPrivateField"></a> <h2>OneMethodPrivateField</h2> <h4>Description</h4>
<p class="body">
Checks that a private field is used in more than one method, constructor, or initializer.
</p>
<p class="body">
Rationale: a private field used in only one method, constructor, or
initializer should be replaced by a local variable.
</p>
<h4>Properties</h4>
<table width="100%" border="1" cellpadding="5" class="body">
<tr class="header">
<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>
<h4>Examples</h4>
<p class="body">
To configure the check:
</p>
<pre class="body">
&lt;module name=&quot;usage.OneMethodPrivateField&quot;/&gt;
</pre>
<p class="body">
To configure the check to ignore fields whose name ends in <span class="code">Temp</span>:
</p>
<pre class="body">
&lt;module name=&quot;usage.OneMethodPrivateField&quot;&gt;
&lt;property name=&quot;ignoreFormat&quot; value=&quot;Temp$&quot;/&gt;
&lt;/module&gt;
</pre>
<h4>Package</h4>
<p class="body">
com.puppycrawl.tools.checkstyle.checks.usage
</p>
<h4>Parent Module</h4>
<p class="body">
<a href="config.html#treewalker">TreeWalker</a>
</p>
<a name="UnusedLocalVariable"></a> <h2>UnusedLocalVariable</h2> <h4>Description</h4>
<p class="body">
Checks that a local variable is used after its declaration.
</p>
</p>
<h4>Properties</h4>
<table width="100%" border="1" cellpadding="5" class="body">
<tr class="header">
<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>
<h4>Examples</h4>
<p class="body">
To configure the check:
</p>
<pre class="body">
&lt;module name=&quot;usage.UnusedLocalVariable&quot;/&gt;
</pre>
<p class="body">
To configure the check to ignore variables whose name ends in <span class="code">Temp</span>:
</p>
<pre class="body">
&lt;module name=&quot;usage.UnusedLocalVariable&quot;&gt;
&lt;property name=&quot;ignoreFormat&quot; value=&quot;Temp$&quot;/&gt;
&lt;/module&gt;
</pre>
<h4>Package</h4>
<p class="body">
com.puppycrawl.tools.checkstyle.checks.usage
</p>
<h4>Parent Module</h4>
<p class="body">
<a href="config.html#treewalker">TreeWalker</a>
</p>
<a name="UnusedParameter"></a> <h2>UnusedParameter</h2> <h4>Description</h4>
<p class="body">
Checks that a parameter is used.
</p>
</p>
<h4>Properties</h4>
<table width="100%" border="1" cellpadding="5" class="body">
<tr class="header">
<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>
<h4>Examples</h4>
<p class="body">
To configure the check:
</p>
<pre class="body">
&lt;module name=&quot;usage.UnusedParameter&quot;/&gt;
</pre>
<p class="body">
To configure the check to ignore parameters whose name ends in <span class="code">Temp</span>:
</p>
<pre class="body">
&lt;module name=&quot;usage.UnusedParameter&quot;&gt;
&lt;property name=&quot;ignoreFormat&quot; value=&quot;Temp$&quot;/&gt;
&lt;/module&gt;
</pre>
<p class="body">
To configure the check to report unused <span class="code">catch</span> parameters:
</p>
<pre class="body">
&lt;module name=&quot;usage.UnusedParameter&quot;&gt;
&lt;property name=&quot;ignoreCatch&quot; value=&quot;false&quot;/&gt;
&lt;/module&gt;
</pre>
<h4>Package</h4>
<p class="body">
com.puppycrawl.tools.checkstyle.checks.usage
</p>
<h4>Parent Module</h4>
<p class="body">
<a href="config.html#treewalker">TreeWalker</a>
</p>
<a name="UnusedPrivateField"></a> <h2>UnusedPrivateField</h2> <h4>Description</h4>
<p class="body">
Checks that a private field is used.
</p>
</p>
<h4>Properties</h4>
<table width="100%" border="1" cellpadding="5" class="body">
<tr class="header">
<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>
<h4>Examples</h4>
<p class="body">
To configure the check:
</p>
<pre class="body">
&lt;module name=&quot;usage.UnusedPrivateField&quot;/&gt;
</pre>
<p class="body">
To configure the check to ignore fields whose name ends in <span class="code">Temp</span>:
</p>
<pre class="body">
&lt;module name=&quot;usage.UnusedPrivateField&quot;&gt;
&lt;property name=&quot;ignoreFormat&quot; value=&quot;Temp$&quot;/&gt;
&lt;/module&gt;
</pre>
<h4>Package</h4>
<p class="body">
com.puppycrawl.tools.checkstyle.checks.usage
</p>
<h4>Parent Module</h4>
<p class="body">
<a href="config.html#treewalker">TreeWalker</a>
</p>
<a name="UnusedPrivateMethod"></a> <h2>UnusedPrivateMethod</h2> <h4>Description</h4>
<p class="body">
Checks that a private method is used.
</p>
</p>
<h4>Properties</h4>
<table width="100%" border="1" cellpadding="5" class="body">
<tr class="header">
<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>
</table>
<h4>Examples</h4>
<p class="body">
To configure the check:
</p>
<pre class="body">
&lt;module name=&quot;usage.UnusedPrivateMethod&quot;/&gt;
</pre>
<p class="body">
To configure the check to ignore methods whose name ends in <span class="code">Temp</span>:
</p>
<pre class="body">
&lt;module name=&quot;usage.UnusedPrivateMethod&quot;&gt;
&lt;property name=&quot;ignoreFormat&quot; value=&quot;Temp$&quot;/&gt;
&lt;/module&gt;
</pre>
<h4>Notes</h4>
<ul class="body">
<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>
<h4>Package</h4>
<p class="body">
com.puppycrawl.tools.checkstyle.checks.usage
</p>
<h4>Parent Module</h4>
<p class="body">
<a href="config.html#treewalker">TreeWalker</a>
</p>
</td>
</tr>
</table>
<hr />
<div><a href="index.html">Back to the Checkstyle Home Page</a></div>
<p class="copyright">
Copyright &copy; 2002-2004 Oliver Burn. All rights Reserved.
</p>
</body>
</html>