Against a snap shot of changes I do not want to lose.
This commit is contained in:
parent
bfe1cbdbed
commit
c6d2120f6e
|
|
@ -9,17 +9,19 @@
|
|||
<h1>Checks for Headers</h1>
|
||||
|
||||
<p>The property <span class="code">checkstyle.header.file</span> controls
|
||||
whether Checkstyle checks that each files with a specified header. The header
|
||||
whether to check that each file begins with a specified header. The header
|
||||
contents are specified in the file. If no file is specified, checkstyle does
|
||||
not check for a header. The property type is <span
|
||||
class="code">java.lang.String</span> and defaults to <span
|
||||
class="default">null</span> (which means do not check).</p>
|
||||
not check for a header. The property type is
|
||||
<a href="property_types.html#string">string</a> and defaults to
|
||||
<span class="default">null</span> (which means do not check).</p>
|
||||
|
||||
<p>The property <span class="code">checkstyle.header.ignoreline</span> can be
|
||||
used to tell Checkstyle to ignore matching lines in a header file. The
|
||||
property type is a list of comma separated integers and defaults to an empty
|
||||
list. This property is very useful for supporting headers that contain
|
||||
copyright dates. For example, consider the following header:</p>
|
||||
<p>The property <span class="code">checkstyle.header.ignoreline</span>
|
||||
specifies the line numbers to ignore when matching lines in a header file. The
|
||||
property type is <a href="property_types.html#intSet">integer set</a> and
|
||||
defaults to an empty list.</p>
|
||||
|
||||
<p>This property is very useful for supporting headers that contain copyright
|
||||
dates. For example, consider the following header:</p>
|
||||
|
||||
<pre>
|
||||
line 1: ///////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -32,10 +34,12 @@ line 4: ///////////////////////////////////////////////////////////////////////
|
|||
to ignore line 3 by setting the property to <span class="code">3</span>.</p>
|
||||
|
||||
<p>The property <span class="code">checkstyle.header.regexp</span> controls
|
||||
whether Checkstyle will interpret each header line as a regular
|
||||
expression. The property type is boolean and defaults to <span
|
||||
class="default">false</span>. For example, consider the following header when
|
||||
regular expression checking is turned on:</p>
|
||||
whether to interpret each header line as a regular expression. The property
|
||||
type is <a href="property_types.html#boolean">boolean</a> and defaults to
|
||||
<span class="default">false</span>.</p>
|
||||
|
||||
<p>For example, consider the following header when regular expression checking
|
||||
is turned on:</p>
|
||||
|
||||
<pre>
|
||||
line 1: /{71}
|
||||
|
|
|
|||
|
|
@ -16,27 +16,40 @@
|
|||
<li>method</li>
|
||||
</ul>
|
||||
|
||||
<p>The property <span class="code">checkstyle.javadoc.scope</span> controls the visibility scope where Javadoc comments are checked. For example, you can check Javadoc code only for <span class="code">public</span> and <span class="code">protected</span> variables, methods, interfaces and class definitions. Scoping rules apply, in the above example a public method in a package visible class is not checked.</p>
|
||||
<p>The property <span class="code">checkstyle.javadoc.scope</span> controls
|
||||
the visibility scope where Javadoc comments are checked. The property type is
|
||||
<a href="property_types.html#scope">scope</a> and defaults to
|
||||
<span class="default">private</span>.</p>
|
||||
|
||||
<p>For example, you can check Javadoc comments only for <span
|
||||
class="code">public</span> and <span class="code">protected</span> definitions
|
||||
by setting the property to <span class="default">protected</span>. Scoping
|
||||
rules apply, so a <span class="code">public</span> method in a package visible
|
||||
class is not checked.</p>
|
||||
|
||||
<p>Valid values for <span class="code">checkstyle.javadoc.scope</span> are:</p>
|
||||
<ul>
|
||||
<li><span class="default">"nothing"</span>
|
||||
<li><span class="default">"public"</span>
|
||||
<li><span class="default">"protected"</span>
|
||||
<li><span class="default">"package"</span>
|
||||
<li><span class="default">"private"</span> (default value)
|
||||
<li><span class="default">"anoninner"</span>
|
||||
</ul>
|
||||
|
||||
<h2>package.html check</h2>
|
||||
<p>The property <span class="code">checkstyle.require.packagehtml</span> controls whether to require that a <span class="code">package.html</span> file exists for each package. The property type is boolean and defaults to <span class="default">false</span>.</p>
|
||||
|
||||
<p>The property <span class="code">checkstyle.require.packagehtml</span>
|
||||
controls whether to require that a <span class="code">package.html</span> file
|
||||
exists for each package. The property type is
|
||||
<a href="property_types.html#boolean">boolean</a> and defaults to
|
||||
<span class="default">false</span>.</p>
|
||||
|
||||
|
||||
<h2>Class/Interface Javadoc checks</h2>
|
||||
|
||||
<p>The property <span class="code">checkstyle.require.version</span> controls whether to require an <span class="default">@version</span> tag to be defined for class and interface Javadoc comments. The property is boolean and defaults to <span class="default">"false"</span>.</p>
|
||||
<p>The property <span class="code">checkstyle.require.version</span> controls
|
||||
whether to require an <span class="default">@version</span> tag to be defined
|
||||
for class and interface Javadoc comments. The property type is
|
||||
<a href="property_types.html#boolean">boolean</a> and defaults to
|
||||
<span class="default">false</span>.</p>
|
||||
|
||||
<p>The property <span class="code">checkstyle.allow.noauthor</span> controls whether to allow no <span class="default">@author</span> tag to be defined for class and interface Javadoc comments. The property is boolean and defaults to <span class="default">"false"</span>.</p>
|
||||
<p>The property <span class="code">checkstyle.allow.noauthor</span> controls
|
||||
whether to allow no <span class="default">@author</span> tag to be defined for
|
||||
class and interface Javadoc comments. The property type is
|
||||
<a href="property_types.html#boolean">boolean</a> and defaults to
|
||||
<span class="default">false</span>.</p>
|
||||
|
||||
<hr>
|
||||
<h2>Method Javadoc checks</h2>
|
||||
|
|
@ -63,11 +76,29 @@
|
|||
int aLineNo)
|
||||
</pre>
|
||||
|
||||
<p>By default an unused <span class="code">@throws</span> tag is reported as error. The property <span class="code">checkstyle.javadoc.checkUnusedThrows</span> controls checking to determine if the exception is a subclass of <span class="code">java.lang.RuntimeException</span>. This supports the convention in the <a href="http://java.sun.com/j2se/javadoc/writingdoccomments/index.html#throwstag">Sun Javadoc Guidelines</a> and the "Effective Java" book. The property is boolean and defaults to <span class="default">false</span>. The classpath may need to be configured to locate the class information..</p>
|
||||
<p>The property <span class="code">checkstyle.javadoc.checkUnusedThrows</span>
|
||||
controls whether to check if an undocumented exception is a subclass of
|
||||
<span class="code">java.lang.RuntimeException</span>. The property type is
|
||||
<a href="property_types.html#boolean">boolean</a> and defaults to
|
||||
<span class="default">false</span>.</p>
|
||||
|
||||
<p>This supports the convention in
|
||||
the <a href="http://java.sun.com/j2se/javadoc/writingdoccomments/index.html#throwstag">Sun Javadoc Guidelines</a>
|
||||
and the "Effective Java" book.</p>
|
||||
|
||||
<p>The classpath may need to be configured to locate the class
|
||||
information. The classpath configuration is dependent on the mechanism used to
|
||||
invoke Checkstyle.</p>
|
||||
|
||||
<div class="tip">
|
||||
<h4 class="tip">Tip</h4>
|
||||
<p>It can be extremely painful writing or duplicating Javadoc for a method required for an interface. Hence checkstyle supports using the convention of using a single <span class="code">@see</span> tag instead of all the other tags. For example, if the previous method was implementing a method required by the <span class="code">com.puppycrawl.tools.checkstyle.Verifier</span> interface, then the Javadoc could be done as:</p>
|
||||
|
||||
<p>It can be extremely painful writing or duplicating Javadoc for a method
|
||||
required for an interface. Hence checkstyle supports using the convention of
|
||||
using a single <span class="code">@see</span> tag instead of all the other
|
||||
tags. For example, if the previous method was implementing a method required
|
||||
by the <span class="code">com.puppycrawl.tools.checkstyle.Verifier</span>
|
||||
interface, then the Javadoc could be done as:</p>
|
||||
|
||||
<pre>
|
||||
/** @see com.puppycrawl.tools.checkstyle.Verifier **/
|
||||
|
|
|
|||
|
|
@ -11,20 +11,21 @@
|
|||
<h2>To-do comments</h2>
|
||||
|
||||
<p>The property <span class="code">checkstyle.pattern.todo</span> specifies
|
||||
the pattern to match for to-do comments. The property type is regular
|
||||
expression and defaults to <span class="default">"TODO:"</span>.</p>
|
||||
the pattern to match for to-do comments. The property type is
|
||||
<a href="property_types.html#regexp">regular expression</a> and defaults to
|
||||
<span class="default">TODO:</span>.</p>
|
||||
|
||||
|
||||
<h2>Integer Literals</h2>
|
||||
|
||||
<p>The property <span class="code">checkstyle.ignore.longell</span> specifies
|
||||
whether Checkstyle verifies that long integer literals use an uppercase <span
|
||||
class="code">L</span>. For example <span class="code">40L</span> instead of
|
||||
<span class="code">40l</span>. This is in accordance to the Java Language
|
||||
Specification, <a
|
||||
href="http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#48282">Section
|
||||
3.10.1</a>. The property type is boolean and defaults to <span
|
||||
class="default">false</span>.</p>
|
||||
whether to not require that long integer literals use an uppercase
|
||||
<span class="code">L</span>. For example <span class="code">40L</span> instead
|
||||
of <span class="code">40l</span>. This is in accordance to the Java Language
|
||||
Specification,
|
||||
<a href="http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#48282">Section 3.10.1</a>.
|
||||
The property type is <a href="property_types.html#boolean">boolean</a> and
|
||||
defaults to <span class="default">false</span>.</p>
|
||||
|
||||
<li>checkstyle.illegal.instantiations"</li>
|
||||
|
||||
|
|
|
|||
|
|
@ -13,76 +13,100 @@ specified naming conventions which are specifed as regular expressions. The
|
|||
excellent <a href="http://jakarta.apache.org/regexp">Jakarta Regexp</a>
|
||||
library is used by Checkstyle.</p>
|
||||
|
||||
<h2>Format of variable names</h2>
|
||||
<h2>Format of members</h2>
|
||||
|
||||
<p>The property <span class="code">checkstyle.pattern.member</span> specifies
|
||||
the format for members (non <span class="code">static</span>). Defaults to
|
||||
<span class="code">^[a-z][a-zA-Z0-9]*$</span>. An example is:</p>
|
||||
the format for members (non <span class="code">static</span>).
|
||||
The property type is
|
||||
<a href="property_types.html#regexp">regular expression</a> and defaults to
|
||||
<span class="code">^[a-z][a-zA-Z0-9]*$</span>.</p>
|
||||
|
||||
<p>An example is:</p>
|
||||
|
||||
<pre>
|
||||
private int mySize = 0;
|
||||
</pre>
|
||||
|
||||
<p>The property <span class="code">checkstyle.pattern.publicmember</span>
|
||||
specifies the format for public members (non
|
||||
<span class="code">static public</span>). The property type is
|
||||
<a href="property_types.html#regexp">regular expression</a> and defaults to
|
||||
<span class="code">^f[A-Z][a-zA-Z0-9]*$</span>.</p>
|
||||
|
||||
<div class="tip">
|
||||
<h4 class="tip">Tip</h4>
|
||||
|
||||
<p>This is useful for the fields required for Container Managed Persistence
|
||||
(CMP) Enterprise JavaBeans 1.1. An example is:</p>
|
||||
|
||||
<pre>
|
||||
public int fCMPField;
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
|
||||
<h2>Format of constants</h2>
|
||||
|
||||
<p>The property <span class="code">checkstyle.pattern.const</span> specifies
|
||||
the format for constants (<span class="code">static</span> and <span
|
||||
class="code">final</span>). Defaults to <span
|
||||
class="code">^[A-Z](_?[A-Z0-9]+)*$</span>. The exception to the rule is for
|
||||
<span class="code">serialVersionUID</span>. An example is:</p>
|
||||
the format for constants (<span class="code">static</span> and
|
||||
<span class="code">final</span>). The property type is
|
||||
<a href="property_types.html#regexp">regular expression</a> and defaults to
|
||||
<span class="code">^[A-Z](_?[A-Z0-9]+)*$</span>.</p>
|
||||
|
||||
<p>The exception to the rule is <span class="code">serialVersionUID</span>. An
|
||||
example is:</p>
|
||||
|
||||
<pre>
|
||||
public static final int MAX_ROWS = 2;
|
||||
</pre>
|
||||
|
||||
|
||||
<h2>Format of statics</h2>
|
||||
|
||||
<p>The property <span class="code">checkstyle.pattern.static</span> specifies
|
||||
the format for static variables (<span class="code">static</span>
|
||||
only). Defaults to <span class="code">^[a-z][a-zA-Z0-9]*$</span>. An example
|
||||
is:</p>
|
||||
the format for static variables (<span class="code">static</span> only).
|
||||
The property type is
|
||||
<a href="property_types.html#regexp">regular expression</a> and defaults to
|
||||
<span class="code">^[a-z][a-zA-Z0-9]*$</span>.</p>
|
||||
|
||||
<p>An example is:</p>
|
||||
|
||||
<pre>
|
||||
private static int numCreated = 0;
|
||||
</pre>
|
||||
|
||||
|
||||
<p>The property <span class="code">checkstyle.pattern.publicmember</span>
|
||||
specifies the format for public members (non <span
|
||||
class="code">static public</span>). Defaults to <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. An
|
||||
example is:</p>
|
||||
|
||||
<pre>
|
||||
public int fCMPField;
|
||||
</pre>
|
||||
|
||||
|
||||
<h2>Format of parameter names</h2>
|
||||
|
||||
<p>The property <span class="code">checkstyle.pattern.parameter</span>
|
||||
specifies the format for parameter names. The default is <span
|
||||
class="code">^[a-z][a-zA-Z0-9]*$</span>.</p>
|
||||
specifies the format for parameter names. The property type is
|
||||
<a href="property_types.html#regexp">regular expression</a> and defaults to
|
||||
<span class="code">^[a-z][a-zA-Z0-9]*$</span>.</p>
|
||||
|
||||
|
||||
<h2>Format of type names</h2>
|
||||
|
||||
<p>The property <span class="code">checkstyle.pattern.type</span> specifies
|
||||
the format for class and interface names. The default is <span
|
||||
class="code">^[A-Z][a-zA-Z0-9]*$</span>.</p>
|
||||
the format for class and interface names. The property type is
|
||||
<a href="property_types.html#regexp">regular expression</a> and defaults to
|
||||
<span class="code">^[A-Z][a-zA-Z0-9]*$</span>.</p>
|
||||
|
||||
|
||||
<h2>Format of method names</h2>
|
||||
|
||||
<p>The property <span class="code">checkstyle.pattern.method</span> specifies
|
||||
the format for method names. The default is <span
|
||||
class="code">^[a-z][a-zA-Z0-9]*$</span>.</p>
|
||||
the format for method names. The property type is
|
||||
<a href="property_types.html#regexp">regular expression</a> and defaults to
|
||||
<span class="code">^[a-z][a-zA-Z0-9]*$</span>.</p>
|
||||
|
||||
|
||||
<h2>Format of local variable names</h2>
|
||||
|
||||
<p>The property <span class="code">checkstyle.pattern.localvar</span>
|
||||
specifies the format for local variables. The default is <span
|
||||
class="code">^[a-z][a-zA-Z0-9]*$</span>. An example is:</p>
|
||||
specifies the format for local variables. The property type is
|
||||
<a href="property_types.html#regexp">regular expression</a> and defaults to
|
||||
<span class="code">^[a-z][a-zA-Z0-9]*$</span>.</p>
|
||||
|
||||
<pre>
|
||||
int localInt = 3;
|
||||
|
|
@ -90,8 +114,9 @@ class="code">^[a-z][a-zA-Z0-9]*$</span>. An example is:</p>
|
|||
|
||||
|
||||
<p>The property <span class="code">checkstyle.pattern.localfinalvar</span>
|
||||
specifies the format for final local variables. The default is <span
|
||||
class="code">^[a-z][a-zA-Z0-9]*$</span>. An example is:</p>
|
||||
specifies the format for final local variables. The property type is
|
||||
<a href="property_types.html#regexp">regular expression</a> and defaults to
|
||||
<span class="code">^[a-z][a-zA-Z0-9]*$</span>.</p>
|
||||
|
||||
<pre>
|
||||
final int finalLocalInt = 3;
|
||||
|
|
|
|||
|
|
@ -12,6 +12,18 @@
|
|||
representations. This document describes how these string representations are
|
||||
mapped to typed properties.</p>
|
||||
|
||||
<h2><a name="integer">Integer</a></h2>
|
||||
|
||||
<p>This property represents an integer. The string representation is parsed
|
||||
using the <span class="code">java.lang.Integer</span> class.</p>
|
||||
|
||||
|
||||
<h2><a name="string">String</a></h2>
|
||||
|
||||
<p>This property represents a string. The literal string representation is
|
||||
used.</p>
|
||||
|
||||
|
||||
<h2><a name="boolean">Boolean</a></h2>
|
||||
|
||||
<p>This property represents a boolean. The default value is <span
|
||||
|
|
@ -33,10 +45,11 @@ class="code">false</span>. The following string representations will map to
|
|||
parsed as a set of comma (',') separated strings.</p>
|
||||
|
||||
|
||||
<h2><a name="integer">Integer</a></h2>
|
||||
<h2><a name="intSet">Integer Set</a></h2>
|
||||
|
||||
<p>This property represents an integer. The string representation is parsed
|
||||
using the <span class="code">java.lang.Integer</span> class.</p>
|
||||
<p>This property represents a set of integers. The string representation is
|
||||
parsed as a set of comma (',') separated integers that are parsed using the
|
||||
<span class="code">java.lang.Integer</span> class.</p>
|
||||
|
||||
|
||||
<h2><a name="regexp">Regular Expression</a></h2>
|
||||
|
|
@ -96,5 +109,21 @@ following table describes the valid options:</p>
|
|||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
<h2><a name="scope">Scope</a></h2>
|
||||
|
||||
<p>This property represents a Java scope. The valid options are:</p>
|
||||
|
||||
<ul>
|
||||
<li><span class="default">nothing</span>
|
||||
<li><span class="default">public</span>
|
||||
<li><span class="default">protected</span>
|
||||
<li><span class="default">package</span>
|
||||
<li><span class="default">private</span>
|
||||
<li><span class="default">anoninner</span>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Reference in New Issue