cleaned up after a review by a colleague.
This commit is contained in:
parent
0e7bf93131
commit
9dd92fc237
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
<h2>What checkstyle checks</h2>
|
||||
|
||||
<h3><a name="imports">Unused Imports</a></h3>
|
||||
<h3><a name="imports">Imports</a></h3>
|
||||
<p>Checks for import statements that are not used. It will warn about wild-card imports like <span class="code">import java.io.*;</span>. It will also warn about duplicate import statements.</p>
|
||||
|
||||
<p>Removing unused import statements reduces unnecessary dependencies in a code base. This feature can be turned off.</p>
|
||||
|
|
@ -94,16 +94,16 @@
|
|||
</div>
|
||||
|
||||
<h3><a name="length">Long Lines</a></h3>
|
||||
<p>Checks for lines that are longer that a specified length. The default is <span class="default">"80"</span>. This can be turned off for <code>import</code> statements.</p>
|
||||
<p>Checks for lines that are longer than a specified length. The default is <span class="default">"80"</span>. This can be turned off for <code>import</code> statements.</p>
|
||||
|
||||
<h3><a name="methodLength">Method Body Length</a></h3>
|
||||
<p>Checks for method bodies that are longer that a specified number of lines. The default is <span class="default">"150"</span>.
|
||||
<p>Checks for method bodies that are longer than a specified number of lines. The default is <span class="default">"150"</span>.
|
||||
|
||||
<h3><a name="constructorLength">Constructor Body Length</a></h3>
|
||||
<p>Checks for constructor bodies that are longer that a specified number of lines. The default is <span class="default">"150"</span>.
|
||||
<p>Checks for constructor bodies that are longer than a specified number of lines. The default is <span class="default">"150"</span>.
|
||||
|
||||
<h3><a name="fileLength">File Length</a></h3>
|
||||
<p>Checks for files that are longer that a specified number of lines. The default is <span class="default">"2000"</span>.
|
||||
<p>Checks for files that are longer than a specified number of lines. The default is <span class="default">"2000"</span>.
|
||||
|
||||
<h3>Tab characters</h3>
|
||||
<p>Checks for lines that contain tab (<code>'\t'</code>) characters. This can be turned off.</p>
|
||||
|
|
@ -166,14 +166,14 @@
|
|||
<p>Verifies that the format of public member names conform to a specified regular expression. The default is <span class="code">^f[A-Z][a-zA-Z0-9]*$</span>. This is useful for the fields required for Container Managed Persistence (CMP) Enterprise JavaBeans 1.1.</p>
|
||||
|
||||
|
||||
<h3>Access Permissions</h3>
|
||||
<h3>Visibility Modifiers</h3>
|
||||
<p>Checks for data members that are not declared <code>private</code>. Also finds <code>static</code> non-<code>final</code> data members that are not declared as <code>private</code>.</p>
|
||||
|
||||
<p>Note: you can turn on allowing <code>protected</code> data members.</p>
|
||||
|
||||
<div class="tip">
|
||||
<h4 class="tip">Tip</h4>
|
||||
<p>Container Managed Persistence EJBs require that managed fields are declared <span class="code">public</span>. This will cause checkstyle to complain that the fields should be declared <span class="code">private</span>. Hence checkstyle supports ignoring <span class="code">public</span> that match a specified regular expression. The default is <span class="code">^f[A-Z][a-zA-Z0-9]*$</span>.</p>
|
||||
<p>Container Managed Persistence EJBs require (in the EJB 1.1 specification) that managed fields are declared <span class="code">public</span>. This will cause checkstyle to complain that the fields should be declared <span class="code">private</span>. Hence checkstyle supports ignoring <span class="code">public</span> that match a specified regular expression. The default is <span class="code">^f[A-Z][a-zA-Z0-9]*$</span>.</p>
|
||||
</div>
|
||||
|
||||
<h3>White space</h3>
|
||||
|
|
|
|||
|
|
@ -75,30 +75,23 @@
|
|||
Sun Code Conventions</a>. However, Checkstyle is highly configurable.
|
||||
</p>
|
||||
|
||||
<p class="body">
|
||||
My experience from using a similar proprietary tool at a previous employer
|
||||
was that it increased the productivity of code reviews. This is because it
|
||||
allowed the reviewers to get on with reviewing the code and not get into
|
||||
"style" debates.
|
||||
</p>
|
||||
|
||||
<a name="features"></a>
|
||||
<h2>Features</h2>
|
||||
<p class="body">The things that checkstyle checks for are:</p>
|
||||
<p class="body">The things that Checkstyle can check for are:</p>
|
||||
<ul>
|
||||
<li class="body">Unused or duplicate <span class="code">import</span> statements. Note: this can be turned off.</li>
|
||||
<li class="body">Unused or duplicate <span class="code">import</span> statements.</li>
|
||||
<li class="body">Javadoc comments are defined for class, interface, variable and method declarations. Note: This can be made to check only <span class="code">public</span> and <span class="code">protected</span> declarations.</li>
|
||||
<li class="body">Javadoc tags for a method match the actual code.</li>
|
||||
<li class="body">The file starts with a specified header. This is useful to ensure that a file has a copyright notice.</li>
|
||||
<li class="body">An <span class="code">@author</span> tag exists for class and interface Javadoc comments. Note: this can be turned off.</li>
|
||||
<li class="body">An <span class="code">@author</span> tag exists for class and interface Javadoc comments.</li>
|
||||
<li class="body">Format of variable names match specified regular expressions. For example, can enforce that all <span class="code">static</span> variables must start with <span class="code">"s"</span>.</li>
|
||||
<li class="body">Format of class and interface names match a specified regular expression.</li>
|
||||
<li class="body">Format of parameter names match a specified regular expression.</li>
|
||||
<li class="body">Variables that are not declared as <span class="code">private</span> or <span class="code">protected</span>.</li>
|
||||
<li class="body">Correct use of white space around binary and unary operators. For example, <span class="code">x -=- 1;</span> is illegal, whereas <span class="code">x -= -1;</span> is not.</li>
|
||||
<li class="body">Ensure white space follows casts and commas. For example both <span class="code">x = (File)obj</span> and <span class="code">run(arg1,arg2)</span> are illegal, whereas <span class="code">x = (File) obj</span> and <span class="code">run(arg1, arg2)</span> are not. Note: these checks can be turned off.</li>
|
||||
<li class="body">Ensure white space follows casts and commas. For example both <span class="code">x = (File)obj</span> and <span class="code">run(arg1,arg2)</span> are illegal, whereas <span class="code">x = (File) obj</span> and <span class="code">run(arg1, arg2)</span> are not.</li>
|
||||
<li class="body">Ensure <span class="code">{}</span>'s are used for <span class="code">if/while/for/do</span> constructs.</li>
|
||||
<li class="body">Lines do not contain tabs. Note: this check can be turned off.</li>
|
||||
<li class="body">Lines do not contain tabs.</li>
|
||||
<li class="body">Lines are not longer than a specified length.</li>
|
||||
<li class="body">Methods/Constructors are not longer than a specified number of lines.</li>
|
||||
<li class="body">Files are not longer than a specified number of lines.</li>
|
||||
|
|
|
|||
Loading…
Reference in New Issue