Checks for Naming Conventions

Checkstyle Logo

Overview

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.naming and are submodules of TreeWalker.

Modules

module validates identifiers for default value of format
AbstractClassName abstract classes ^Abstract.*$|^.*Factory$
ConstantName constants (static, final fields) ^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$
LocalFinalVariableName local, final variables ^[a-z][a-zA-Z0-9]*$
LocalVariableName local, non-final variables, including catch parameters ^[a-z][a-zA-Z0-9]*$
MemberName 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-Z0-9_]*)*$
ParameterName parameters ^[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]*$

Notes


Back to the Checkstyle Home Page