diff --git a/docs/config_naming.html b/docs/config_naming.html index e4de6c7b0..b6a263bfe 100644 --- a/docs/config_naming.html +++ b/docs/config_naming.html @@ -1,151 +1,139 @@ - - + + +
Checks for Naming Conventions |
+ ![]() |
+
+ Each of these naming modules validates identifiers for particular code elements. Valid + identifiers for a naming module are specified by its + format property. The value of format is a regular + expression for valid identifiers. + This is an example of a configuration of the MemberName module to + ensure that member identifiers begin with 'm', + followed by an upper case letter, and then letters and digits: +
++ <module name="MemberName"> + <property name="format" value="^m[A-Z][a-zA-Z0-9]*$"/> + </module> ++
+ All naming modules belong to package + com.puppycrawl.tools.checkstyle.checks and are submodules of + TreeWalker. +
+Checkstyle supports checking that names in a Java code confirms to -specified naming conventions which are specifed as regular expressions. The -excellent Jakarta Regexp -library is used by Checkstyle.
- -The property checkstyle.pattern.member specifies -the format for members (non static). -The property type is -regular expression and defaults to -^[a-z][a-zA-Z0-9]*$.
- -An example is:
- -- private int mySize = 0; -- -
The property checkstyle.pattern.publicmember -specifies the format for public members (non -static public). The property type is -regular expression and defaults to -^f[A-Z][a-zA-Z0-9]*$.
- -This is useful for the fields required for Container Managed Persistence -(CMP) Enterprise JavaBeans 1.1. An example is:
- -- public int fCMPField; --
The property checkstyle.pattern.const specifies -the format for constants (static and -final). The property type is -regular expression and defaults to -^[A-Z](_?[A-Z0-9]+)*$.
- -The exception to the rule is serialVersionUID. An -example is:
- -- public static final int MAX_ROWS = 2; -- - -
The property checkstyle.pattern.static specifies -the format for static variables (static only). -The property type is -regular expression and defaults to -^[a-z][a-zA-Z0-9]*$.
- -An example is:
- -- private static int numCreated = 0; -- - - -
The property checkstyle.pattern.parameter -specifies the format for parameter names. The property type is -regular expression and defaults to -^[a-z][a-zA-Z0-9]*$.
- - -The property checkstyle.pattern.package specifies -the format for class and interface names. The property type is -regular expression and defaults to -^[a-z]+(\.[a-zA-Z_][a-zA-Z_0-9]*)*$.
- -| module | +validates identifiers for | +default value of format | +
|---|---|---|
| ConstantName | +constants (static, + final fields) | +^[A-Z](_?[A-Z0-9]+)*$ | +
| LocalFinalVariableName | +local, final variables | +^[a-z][a-zA-Z0-9]*$ | +
| LocalVariableName | +local, non-final variables | +^[a-z][a-zA-Z0-9]*$ | +
| MemberName | +non-public, non-static fields | +^[a-z][a-zA-Z0-9]*$ | +
| MethodName | +methods | +^[a-z][a-zA-Z0-9]*$ | +
| PackageName | +packages | +^[a-z]+(\\.[a-zA-Z_][a-zA-Z_0-9]*)*$ | +
| ParameterName | +parameters | +^[a-z][a-zA-Z0-9]*$ | +
| PublicMemberName | +public, non-static fields | +^f[A-Z][a-zA-Z0-9]*$ | +
| StaticVariableName | +static, non-final fields | +^[a-z][a-zA-Z0-9]*$ | +
| TypeName | +classes and interfaces | +^[A-Z][a-zA-Z0-9]*$ | +
+ <module name="PackageName"> + <property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/> + </module> ++
+ <module name="TypeName"> + <property name="format" value="^I_[a-zA-Z0-9]*$"/> + <property name="tokens" value="INTERFACE_DEF"/> + </module> ++
-The default value of checkstyle.pattern.package -has been chosen to match the requirements in the - -Java Language specification and the Sun coding conventions. -However both underscores and uppercase letters are rather uncommon, so most projects -should probably use -checkstyle.pattern.package=^[a-z]+(\.[a-z][a-z0-9]*)*$ +Copyright © 2002 Oliver Burn. All rights Reserved.
-The property checkstyle.pattern.type specifies -the format for class and interface names. The property type is -regular expression and defaults to -^[A-Z][a-zA-Z0-9]*$.
- - -The property checkstyle.pattern.method specifies -the format for method names. The property type is -regular expression and defaults to -^[a-z][a-zA-Z0-9]*$.
- - -The property checkstyle.pattern.localvar -specifies the format for local variables. The property type is -regular expression and defaults to -^[a-z][a-zA-Z0-9]*$.
- -- int localInt = 3; -- - -
The property checkstyle.pattern.localfinalvar -specifies the format for final local variables. The property type is -regular expression and defaults to -^[a-z][a-zA-Z0-9]*$.
- -- final int finalLocalInt = 3; -- -
Copyright © 2002 Oliver Burn. All rights Reserved.
\ No newline at end of file