Documented the rcurly option

This commit is contained in:
Oliver Burn 2002-02-23 11:14:59 +00:00
parent 47383398f8
commit 171e8d02b5
3 changed files with 57 additions and 13 deletions

View File

@ -52,7 +52,12 @@ This task is included in the checkstyle distribution.</p>
</tr>
<tr>
<td valign="top">lcurlyOther</td>
<td valign="top">Specifies the policy of where to put the left brace <span class=code>'{'</span> for other declarations. What keywords are covered is defined <a href="engine.html#lcurlyother">here</a>. The legal values are defined <a href="engine.html#lcurlyopt">here</a>. Defaults to <span class="default">&quot;eol&quot;</span>.</td>
<td valign="top">Specifies the policy of where to put the left brace <span class=code>'{'</span> for other declarations. The keywords covered is defined <a href="engine.html#lcurlyother">here</a>. The legal values are defined <a href="engine.html#lcurlyopt">here</a>. Defaults to <span class="default">&quot;eol&quot;</span>.</td>
<td align="center" valign="top">No</td>
</tr>
<tr>
<td valign="top">rcurly</td>
<td valign="top">Specifies the policy of where to put the right brace <span class=code>'}'</span>. The keywords covered is defined <a href="engine.html#rcurly">here</a>. The legal values are defined <a href="engine.html#rcurlyopt">here</a>. Defaults to <span class="default">&quot;same&quot;</span>.</td>
<td align="center" valign="top">No</td>
</tr>
<tr>

View File

@ -56,8 +56,12 @@ This command line tool is included in the checkstyle distribution.</p>
</tr>
<tr>
<td valign="top">checkstyle.lcurly.other</td>
<td valign="top">Specifies the policy of where to put the left brace <span class=code>'{'</span> for other declarations. What keywords are covered is defined <a href="engine.html#lcurlyother">here</a>. The legal values are defined <a href="engine.html#lcurlyopt">here</a>. Defaults to <span class="default">&quot;eol&quot;</span>.</td>
</tr>
<td valign="top">Specifies the policy of where to put the left brace <span class=code>'{'</span> for other declarations. The keywords covered is defined <a href="engine.html#lcurlyother">here</a>. The legal values are defined <a href="engine.html#lcurlyopt">here</a>. Defaults to <span class="default">&quot;eol&quot;</span>.</td>
</tr>
<tr>
<td valign="top">checkstyle.rcurly</td>
<td valign="top">Specifies the policy of where to put the right brace <span class=code>'}'</span>. The keywords covered is defined <a href="engine.html#rcurly">here</a>. The legal values are defined <a href="engine.html#rcurlyopt">here</a>. Defaults to <span class="default">&quot;same&quot;</span>.</td>
</tr>
<tr>
<td valign="top">checkstyle.allow.protected</td>
<td valign="top">Indicates whether to allow protected data. Defaults to <span class="default">&quot;no&quot;</span>.</td>

View File

@ -105,6 +105,15 @@
<td><span class="code">ignore</span></td>
<td>Ignore the placement of the brace.</td>
</tr>
<tr>
<td><span class="code">eol</span></td>
<td>The brace must always be on the end of the line. For example:
<pre>
if (condition) {
...
</pre>
This is the default value.
</tr>
<tr>
<td><span class="code">nl</span></td>
<td>The brace must always be on a new line. For example:
@ -115,15 +124,6 @@
</pre>
</td>
</tr>
<tr>
<td><span class="code">eol</span></td>
<td>The brace must always be on the end of the line. For example:
<pre>
if (condition) {
...
</pre>
This is the default value.
</tr>
<tr>
<td><span class="code">nlow</span></td>
<td>If the brace will fit on the first line of the statement, taking into account making line length, then apply <span class="code">eol</span> rule. Otherwise apply the <span class="code">nl</span> rule. <span class="code">nlow</span> is a mnemonic for "new line on wrap". For the example above Checkstyle will enforce:
@ -142,7 +142,42 @@
</tr>
</table>
<p><a name="lcurlyother"></a>The check can be tailored for types, methods and others. What is included in others are the keywords <span class="code">switch</span>, <span class="code">while</span>, <span class="code">for</span>, <span class="code">do</span>, <span class="code">if</span>, <span class="code">else</span>, <span class="code">synchronized</span>, <span class="code">try</span>, <span class="code">catch</span>, <span class="code">finally</span>, <span class="code">static</span>.</p>
<p><a name="lcurlyother"></a>The check can be tailored for types, methods and others. What is included in others are the keywords <span class="code">switch</span>, <span class="code">while</span>, <span class="code">for</span>, <span class="code">do</span>, <span class="code">if</span>, <span class="code">else</span>, <span class="code">synchronized</span>, <span class="code">try</span>, <span class="code">catch</span>, <span class="code">finally</span> and <span class="code">static</span>.</p>
<p><a name="rcurly"></a>There is also a check for the correct placement of right curly braces <span class="code">'}'</span> with the keywords <span class="code">else</span>, <span class="code">catch</span> and <span class="code">finally</span>. The check can be configured with the following options:</p>
<a name="rcurlyopt"></a>
<table border="1" summary="right curly options">
<tr class="header">
<td>Option</td>
<td>Definition</td>
</tr>
<tr>
<td><span class="code">ignore</span></td>
<td>Ignore the placement of the brace.</td>
</tr>
<tr>
<td><span class="code">same</span></td>
<td>The brace must be on the same line as the next statement. For example:
<pre>
try {
...
} finally {
</pre>
This is the default value.
</td>
</tr>
<tr>
<td><span class="code">alone</span></td>
<td>The brace must be alone on the line. For example:
<pre>
try {
...
}
finally {
</pre>
</tr>
</table>
<h3><a name="length">Long Lines</a></h3>
<p>Checks for lines that are longer than a specified length. The default is <span class="default">&quot;80&quot;</span>. This can be turned off for <code>import</code> statements.</p>