From 8ccfddcd2dd9955b035104d2e363406028d8a00d Mon Sep 17 00:00:00 2001 From: Rick Giles Date: Thu, 19 Dec 2002 00:04:37 +0000 Subject: [PATCH] version 3.0 documentation and minor corrections --- docs/config_blocks.html | 340 ++++++++++++++---- docs/config_modifiers.html | 2 +- .../checkstyle/checks/RightCurlyCheck.java | 2 +- 3 files changed, 265 insertions(+), 79 deletions(-) diff --git a/docs/config_blocks.html b/docs/config_blocks.html index 81b291de0..65dfc2aef 100644 --- a/docs/config_blocks.html +++ b/docs/config_blocks.html @@ -1,89 +1,275 @@ - - + + + - Checks for Blocks - + Checks for blocks + -

Checks for Blocks

+ + + + + + +

Checks for blocks

Checkstyle Logo
+ + + + + + + + +

EmptyBlock

+

Description

+

+ Checks for empty blocks. +

+

Properties

+ + + + + + + + + + + + + + + + + + + +
namedescriptiontypedefault value
optionpolicy on block contentsblock policystmt
tokensblocks to checksubset of tokens LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, + LITERAL_IF, LITERAL_FOR, LITERAL_TRY, LITERAL_WHILE, STATIC_INITall tokens
-

Missing Braces

+

Examples

+

+ To configure the check: +

+
+<module name="EmptyBlock"/>
+      
+

+ To configure the check for the text policy and only + catch blocks: +

+
+<module name="EmptyBlock">
+    <property name="option" value="text"/>
+    <property name="tokens" value="LITERAL_CATCH"/>
+</module>
+      
+

Package

+

+ com.puppycrawl.tools.checkstyle.checks +

+

Parent Module

+

+ TreeWalker +

+

LeftCurly Checks

Description

+

+ There are three checks for the placement of left curly braces (' + {') for code blocks: +

+
    +
  • + MethodLeftCurly checks for methods and constructors. + It's token set is METHOD_DEF and CTOR_DEF. +
  • +
  • + TypeLeftCurly checks for classes and interfaces. It's + token set is CLASS_DEF and INTERFACE_DEF. +
  • +
  • + OtherLeftCurly checks for blocks other than methods, + constructors, and types. It's token set is LITERAL_CATCH, LITERAL_DO, + LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_SWITCH, + LITERAL_SYNCHRONIZED, LITERAL_TRY, and LITERAL_WHILE. +
  • +
+

+ All left curly brace checks have a policy to verify that is specified using + property option. Policies eol and + nlow take into account property maxLineLength. +

+

Properties other than tokens

+ + + + + + + + + + + + + + + + + + + +
namedescriptiontypedefault value
optionpolicy on placement of a left curly brace ('{')left curly brace policyeol
maxLineLengthmaximum number of characters in a lineinteger80
-

The property checkstyle.ignore.braces controls -whether to ignore checking for missing braces {}'s -for the following constructs:

+

Examples

+

+ To configure the OtherLeftCurly check: +

+
+<module name="OtherLeftCurly"/>
+      
+

+ To configure the MethodLeftCurly check for the nl policy and maximum + line length 120: +

+
+<module name="MethodLeftCurly">
+    <property name="option" value="nl"/>
+    <property name="maxLineLength" value="120"/>
+</module>
+      
+

Package

+

+ com.puppycrawl.tools.checkstyle.checks +

+

Parent Module

+

+ TreeWalker +

+

NeedBraces

Description

+

+ Checks for braces around code blocks. +

+

Properties

+ + + + + + + + + + + + + +
namedescriptiontypedefault value
tokensblocks to checksubset of tokens LITERAL_DO, LITERAL_ELSE, LITERAL_IF, LITERAL_FOR, + LITERAL_WHILEall tokens
-
    -
  • if/else
  • -
  • while
  • -
  • for
  • -
  • do/while
  • -
+

Examples

+

+ To configure the check: +

+
+<module name="NeedBraces"/>
+      
+

+ To configure the check for if and + else blocks: +

+
+<module name="NeedBraces">
+    <property name="tokens" value="LITERAL_IF, LITERAL_ELSE"/>
+</module>
+      
+

Package

+

+ com.puppycrawl.tools.checkstyle.checks +

+

Parent Module

+

+ TreeWalker +

+

RightCurly

Description

+

+ Checks the placement of right curly braces ('}') for + else, try, and catch + tokens. The policy to verify is specified using property + option. +

+

Properties

+ + + + + + + + + + + + + + + + + + + +
namedescriptiontypedefault value
optionpolicy on placement of a right curly brace ('}')right curly brace policysame
tokensblocks to checksubset of tokens LITERAL_CATCH, LITERAL_ELSE, LITERAL_TRYLITERAL_CATCH, LITERAL_ELSE, LITERAL_TRY
-

The property type is boolean and -defaults to false.

+

Examples

+

+ To configure the check: +

+
+<module name="RightCurly"/>
+      
+

+ To configure the check with policy alone for + else tokens: +

+
+<module name="RightCurly">
+    <property name="option" value="alone"/>
+    <property name="tokens" value="LITERAL_ELSE"/>
+</module>
+      
+

Package

+

+ com.puppycrawl.tools.checkstyle.checks +

+

Parent Module

+

+ TreeWalker +

+
-

Empty Blocks

- -

The property checkstyle.block.try specifies the -policy on how to check try blocks. The property type -is block policy and defaults to -stmt.

- -

The property checkstyle.block.catch specifies the -policy on how to check catch blocks. The property type -is block policy and defaults to -text.

- -

The property checkstyle.block.finally specifies the -policy on how to check finally blocks. The property -type is block policy and defaults to -stmt.

- - -

left curly brace placement

- -

Checkstyle enforces the correct placement of left curly braces -'{'.

- -

The property checkstyle.lcurly.type specifies the -policy to check the placement of the left curly brace for -class and interface blocks. -The property type is -left curly brace policy and defaults -to eol.

- -

The property checkstyle.lcurly.method specifies the -policy to check the placement of the left curly brace for method blocks. -The property type is -left curly brace policy and defaults -to eol.

- -

The property checkstyle.lcurly.other specifies -the policy to check the placement of the left curly brace for all other -blocks. This includes switch, -while, for, -do, if, -else, synchronized, -try, catch, -finally and static blocks. -The property type is -left curly brace policy and defaults -to eol.

- - -

right curly brace placement

- -

The property checkstyle.rcurly specifies the -policy to check the placement of the right curly braces -'}' for blocks. -The property type is -right curly brace policy and defaults -to same.

- -
-

Copyright © 2002 Oliver Burn. All rights Reserved.

+
+

+Copyright © 2002 Oliver Burn. All rights Reserved. +

\ No newline at end of file diff --git a/docs/config_modifiers.html b/docs/config_modifiers.html index 699ec4e34..8420f8189 100644 --- a/docs/config_modifiers.html +++ b/docs/config_modifiers.html @@ -185,7 +185,7 @@ Language specification, section 9.4).

 <module name="VisibilityModifier">
-    <property name="publicMemberPattern" value="^$;"/>
+    <property name="publicMemberPattern" value="^$"/>
 </module>
       

Package

diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/RightCurlyCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/RightCurlyCheck.java index 14b06d824..cae385fc7 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/RightCurlyCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/RightCurlyCheck.java @@ -56,7 +56,7 @@ public class RightCurlyCheck extends AbstractOptionCheck { /** - * Sets the right curly otion to same. + * Sets the right curly option to same. */ public RightCurlyCheck() {