| <?xml version="1.0" encoding="UTF-8"?> |
| |
| <document xmlns="http://maven.apache.org/XDOC/2.0" |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd"> |
| |
| <head> |
| <title>Naming Conventions</title> |
| <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"/> |
| <script type="text/javascript" src="js/anchors.js"/> |
| <script type="text/javascript" src="js/google-analytics.js"/> |
| <link rel="icon" href="images/favicon.png" type="image/x-icon" /> |
| <link rel="shortcut icon" href="images/favicon.ico" type="image/ico" /> |
| </head> |
| |
| <body> |
| <section name="Content"> |
| <macro name="toc"> |
| <param name="fromDepth" value="1"/> |
| <param name="toDepth" value="1"/> |
| </macro> |
| </section> |
| |
| <section name="Overview"> |
| <p> |
| Each of these naming modules validates identifiers for particular code |
| elements. Valid identifiers for a naming module are specified by its |
| <code> format</code> property. The value of <code>format</code> is a <a |
| href="https://docs.oracle.com/javase/1.5.0/docs/api/java/util/regex/Pattern.html"> |
| regular expression</a> for valid identifiers. |
| </p> |
| </section> |
| |
| <section name="AbbreviationAsWordInName"> |
| <subsection name="Description"> |
| <p>Since Checkstyle 5.8</p> |
| <p> |
| The Check validate abbreviations(consecutive capital letters) |
| length in identifier name, it also allows to enforce camel case naming. Please read more at |
| <a href="http://checkstyle.sourceforge.net/reports/google-java-style-20170228.html#s5.3-camel-case"> |
| Google Style Guide</a> |
| to get to know how to avoid long abbreviations in names. |
| </p> |
| |
| <p> |
| <i>allowedAbbreviationLength</i> specifies how many consecutive capital letters are |
| allowed in the identifier. |
| A value of <i>3</i> indicates that up to 4 consecutive capital letters are allowed, |
| one after the other, before a violation is printed. The identifier 'MyTEST' would be |
| allowed, but 'MyTESTS' would not be. |
| A value of <i>0</i> indicates that only 1 consecutive capital letter is allowed. This |
| is what should be used to enforce strict camel casing. The identifier 'MyTest' would |
| be allowed, but 'MyTEst' would not be. |
| </p> |
| </subsection> |
| |
| <subsection name="Properties"> |
| <table> |
| <tr> |
| <th>name</th> |
| <th>description</th> |
| <th>type</th> |
| <th>default value</th> |
| <th>since</th> |
| </tr> |
| <tr> |
| <td>allowedAbbreviationLength</td> |
| <td>indicates on the number of consecutive capital letters allowed in targeted identifiers |
| (abbreviations in the classes, interfaces, variables and methods names, ... ).</td> |
| <td><a href="property_types.html#integer">Integer</a></td> |
| <td>3</td> |
| <td>5.8</td> |
| </tr> |
| <tr> |
| <td>allowedAbbreviations</td> |
| <td>list of abbreviations that must be skipped for checking. |
| Abbreviations should be separated by comma, no spaces are allowed.</td> |
| <td><a href="property_types.html#stringSet">String Set</a></td> |
| <td>null</td> |
| <td>5.8</td> |
| </tr> |
| <tr> |
| <td>ignoreFinal</td> |
| <td>allow to skip variables with final modifier.</td> |
| <td><a href="property_types.html#boolean">Boolean</a></td> |
| <td>true</td> |
| <td>5.8</td> |
| </tr> |
| <tr> |
| <td>ignoreStatic</td> |
| <td>allow to skip variables with static modifier.</td> |
| <td><a href="property_types.html#boolean">Boolean</a></td> |
| <td>true</td> |
| <td>5.8</td> |
| </tr> |
| <tr> |
| <td>ignoreOverriddenMethods</td> |
| <td>Allows to ignore methods tagged with @Override annotation |
| (that usually mean inherited name).</td> |
| <td><a href="property_types.html#boolean">Boolean</a></td> |
| <td>true</td> |
| <td>5.8</td> |
| </tr> |
| <tr> |
| <td>tokens</td> |
| <td>tokens to check</td> |
| <td> |
| subset of tokens |
| <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#CLASS_DEF">CLASS_DEF</a>, |
| <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#INTERFACE_DEF">INTERFACE_DEF</a>, |
| <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ENUM_DEF">ENUM_DEF</a>, |
| <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ANNOTATION_DEF">ANNOTATION_DEF</a>, |
| <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ANNOTATION_FIELD_DEF">ANNOTATION_FIELD_DEF</a>, |
| <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#PARAMETER_DEF">PARAMETER_DEF</a>, |
| <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#VARIABLE_DEF">VARIABLE_DEF</a>, |
| <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#METHOD_DEF">METHOD_DEF</a>, |
| <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ENUM_CONSTANT_DEF">ENUM_CONSTANT_DEF</a>. |
| </td> |
| <td> |
| <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#CLASS_DEF">CLASS_DEF</a>, |
| <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#INTERFACE_DEF">INTERFACE_DEF</a>, |
| <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ENUM_DEF">ENUM_DEF</a>, |
| <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ANNOTATION_DEF">ANNOTATION_DEF</a>, |
| <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ANNOTATION_FIELD_DEF">ANNOTATION_FIELD_DEF</a>, |
| <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#PARAMETER_DEF">PARAMETER_DEF</a>, |
| <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#VARIABLE_DEF">VARIABLE_DEF</a>, |
| <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#METHOD_DEF">METHOD_DEF</a>. |
| </td> |
| <td>5.8</td> |
| </tr> |
| </table> |
| </subsection> |
| |
| <subsection name="Examples"> |
| <p> |
| Default configuration |
| <source> |
| <module name="AbbreviationAsWordInName"/> |
| </source> |
| </p> |
| <p> |
| To configure to check variables and classes identifiers, |
| do not ignore variables with static modifier and allow |
| no abbreviations (enforce camel case phrase) and |
| allow no abbreviations to use (camel case phrase) and allow XML and URL abbreviations. |
| </p> |
| <source> |
| <module name="AbbreviationAsWordInName"> |
| <property name="tokens" value="VARIABLE_DEF,CLASS_DEF"/> |
| <property name="ignoreStatic" value="false"/> |
| <property name="allowedAbbreviationLength" value="1"/> |
| <property name="allowedAbbreviations" value="XML,URL"/> |
| </module> |
| </source> |
| </subsection> |
| |
| <subsection name="Example of Usage"> |
| <ul> |
| <li> |
| <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Agoogle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+AbbreviationAsWordInName"> |
| Google Style</a> |
| </li> |
| <li> |
| <a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+AbbreviationAsWordInName"> |
| Checkstyle Style</a> |
| </li> |
| </ul> |
| </subsection> |
| |
| <subsection name="Error Messages"> |
| <ul> |
| <li> |
| <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22abbreviation.as.word%22"> |
| abbreviation.as.word</a> |
| </li> |
| </ul> |
| <p> |
| All messages can be customized if the default message doesn't suit you. |
| Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to. |
| </p> |
| </subsection> |
| |
| <subsection name="Package"> |
| <p> com.puppycrawl.tools.checkstyle.checks.naming </p> |
| </subsection> |
| |
| <subsection name="Parent Module"> |
| <p> <a href="config.html#TreeWalker">TreeWalker</a> </p> |
| </subsection> |
| </section> |
| |
| <section name="AbstractClassName"> |
| <subsection name="Description"> |
| <p>Since Checkstyle 3.2</p> |
| <p>Validates identifiers for <code>abstract</code> classes.</p> |
| </subsection> |
| |
| <subsection name="Properties"> |
| <table> |
| <tr> |
| <th>name</th> |
| <th>description</th> |
| <th>type</th> |
| <th>default value</th> |
| <th>since</th> |
| </tr> |
| <tr> |
| <td>format</td> |
| <td>Specifies valid identifiers.</td> |
| <td><a href="property_types.html#regexp">Regular Expression</a></td> |
| <td><code>"^Abstract.+$"</code></td> |
| <td>3.2</td> |
| </tr> |
| <tr> |
| <td>ignoreModifier</td> |
| <td> |
| Controls whether to ignore checking for the |
| <code>abstract</code> modifier on classes that match the |
| name. |
| </td> |
| <td><a href="property_types.html#boolean">Boolean</a></td> |
| <td><code>false</code></td> |
| <td>5.3</td> |
| </tr> |
| <tr> |
| <td>ignoreName</td> |
| <td> |
| Controls whether to ignore checking the name. Realistically |
| only useful if using the check to identify that match name |
| and do not have the <code>abstract</code> modifier. name. |
| </td> |
| <td><a href="property_types.html#boolean">Boolean</a></td> |
| <td><code>false</code></td> |
| <td>5.3</td> |
| </tr> |
| </table> |
| </subsection> |
| |
| <subsection name="Examples"> |
| <p> |
| The following example shows how to configure the |
| <code>AbstractClassName</code> to checks names, but ignore |
| missing <code>abstract</code> modifiers: |
| </p> |
| <source> |
| <module name="AbstractClassName"> |
| <property name="ignoreModifier" value="true"/> |
| </module> |
| </source> |
| </subsection> |
| |
| <subsection name="Example of Usage"> |
| <ul> |
| <li> |
| <a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+AbstractClassName"> |
| Checkstyle Style</a> |
| </li> |
| </ul> |
| </subsection> |
| |
| <subsection name="Error Messages"> |
| <ul> |
| <li> |
| <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22illegal.abstract.class.name%22"> |
| illegal.abstract.class.name</a> |
| </li> |
| <li> |
| <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22no.abstract.class.modifier%22"> |
| no.abstract.class.modifier</a> |
| </li> |
| </ul> |
| <p> |
| All messages can be customized if the default message doesn't suit you. |
| Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to. |
| </p> |
| </subsection> |
| |
| <subsection name="Package"> |
| <p> com.puppycrawl.tools.checkstyle.checks.naming </p> |
| </subsection> |
| |
| <subsection name="Parent Module"> |
| <p> <a href="config.html#TreeWalker">TreeWalker</a> </p> |
| </subsection> |
| </section> |
| |
| <section name="CatchParameterName"> |
| <subsection name="Description"> |
| <p>Since Checkstyle 6.14</p> |
| <p> |
| Checks that catch parameter names conform to a format specified by the format property. |
| Default pattern has the following characteristic: |
| </p> |
| <ul> |
| <li>allows names beginning with two lowercase letters followed by at least one uppercase |
| or lowercase letter</li> |
| <li>allows <code>e</code> abbreviation (suitable for exceptions end errors)</li> |
| <li>allows <code>ex</code> abbreviation (suitable for exceptions)</li> |
| <li>allows <code>t</code> abbreviation (suitable for throwables)</li> |
| <li>prohibits numbered abbreviations like <code>e1</code> or <code>t2</code></li> |
| <li>prohibits one letter prefixes like <code>pException</code></li> |
| <li>prohibits two letter abbreviations like <code>ie</code> or <code>ee</code></li> |
| <li>prohibits any other characters than letters</li> |
| </ul> |
| </subsection> |
| |
| <subsection name="Properties"> |
| <table> |
| <tr> |
| <th>name</th> |
| <th>description</th> |
| <th>type</th> |
| <th>default value</th> |
| <th>since</th> |
| </tr> |
| <tr> |
| <td>format</td> |
| <td>Specifies valid identifiers.</td> |
| <td> |
| <a href="property_types.html#regexp">Regular Expression</a> |
| </td> |
| <td> |
| <code>"^(e|t|ex|[a-z][a-z][a-zA-Z]+)$"</code> |
| </td> |
| <td>6.14</td> |
| </tr> |
| </table> |
| </subsection> |
| |
| <subsection name="Examples"> |
| <p> |
| To configure the check: |
| </p> |
| <source> |
| <module name="CatchParameterName"/> |
| </source> |
| <p> |
| An example of how to configure the check for names that begin with |
| a lower case letter, followed by letters and digits is: |
| </p> |
| <source> |
| <module name="CatchParameterName"> |
| <property name="format" value="^[a-z][a-zA-Z0-9]+$"/> |
| </module> |
| </source> |
| </subsection> |
| |
| <subsection name="Example of Usage"> |
| <ul> |
| <li> |
| <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Agoogle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+CatchParameterName"> |
| Google Style |
| </a> |
| </li> |
| <li> |
| <a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+CatchParameterName"> |
| Checkstyle Style |
| </a> |
| </li> |
| </ul> |
| </subsection> |
| |
| <subsection name="Error Messages"> |
| <ul> |
| <li> |
| <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22name.invalidPattern%22"> |
| name.invalidPattern</a> |
| </li> |
| </ul> |
| <p> |
| All messages can be customized if the default message doesn't suit you. |
| Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to. |
| </p> |
| </subsection> |
| |
| <subsection name="Package"> |
| <p>com.puppycrawl.tools.checkstyle.checks.naming</p> |
| </subsection> |
| |
| <subsection name="Parent Module"> |
| <p> |
| <a href="config.html#TreeWalker">TreeWalker</a> |
| </p> |
| </subsection> |
| </section> |
| |
| <section name="ClassTypeParameterName"> |
| <subsection name="Description"> |
| <p>Since Checkstyle 5.0</p> |
| <p>Validates identifiers for class type parameters.</p> |
| </subsection> |
| |
| <subsection name="Properties"> |
| <table> |
| <tr> |
| <th>name</th> |
| <th>description</th> |
| <th>type</th> |
| <th>default value</th> |
| <th>since</th> |
| </tr> |
| <tr> |
| <td>format</td> |
| <td>Specifies valid identifiers.</td> |
| <td><a href="property_types.html#regexp">Regular Expression</a></td> |
| <td><code>"^[A-Z]$"</code></td> |
| <td>5.0</td> |
| </tr> |
| </table> |
| </subsection> |
| |
| <subsection name="Examples"> |
| <p> |
| To configure the check: |
| </p> |
| <source> |
| <module name="ClassTypeParameterName"/> |
| </source> |
| </subsection> |
| |
| <subsection name="Example of Usage"> |
| <ul> |
| <li> |
| <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Agoogle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+ClassTypeParameterName"> |
| Google Style</a> |
| </li> |
| <li> |
| <a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+ClassTypeParameterName"> |
| Checkstyle Style</a> |
| </li> |
| </ul> |
| </subsection> |
| |
| <subsection name="Error Messages"> |
| <ul> |
| <li> |
| <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22name.invalidPattern%22"> |
| name.invalidPattern</a> |
| </li> |
| </ul> |
| <p> |
| All messages can be customized if the default message doesn't suit you. |
| Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to. |
| </p> |
| </subsection> |
| |
| <subsection name="Package"> |
| <p> com.puppycrawl.tools.checkstyle.checks.naming </p> |
| </subsection> |
| |
| <subsection name="Parent Module"> |
| <p> <a href="config.html#TreeWalker">TreeWalker</a> </p> |
| </subsection> |
| </section> |
| |
| <section name="ConstantName"> |
| <subsection name="Description"> |
| <p>Since Checkstyle 3.0</p> |
| <p> |
| Validates identifiers for constants (<code>static</code>, <code> |
| final</code> fields). |
| </p> |
| </subsection> |
| |
| <subsection name="Properties"> |
| <table> |
| <tr> |
| <th>name</th> |
| <th>description</th> |
| <th>type</th> |
| <th>default value</th> |
| <th>since</th> |
| </tr> |
| <tr> |
| <td>format</td> |
| <td>Specifies valid identifiers.</td> |
| <td><a href="property_types.html#regexp">Regular Expression</a></td> |
| <td><code>"^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$"</code></td> |
| <td>3.0</td> |
| </tr> |
| <tr> |
| <td>applyToPublic</td> |
| <td>Controls whether to apply the check to public member.</td> |
| <td><a href="property_types.html#boolean">Boolean</a></td> |
| <td><code>true</code></td> |
| <td>5.0</td> |
| </tr> |
| <tr> |
| <td>applyToProtected</td> |
| <td>Controls whether to apply the check to protected member.</td> |
| <td><a href="property_types.html#boolean">Boolean</a></td> |
| <td><code>true</code></td> |
| <td>5.0</td> |
| </tr> |
| <tr> |
| <td>applyToPackage</td> |
| <td> |
| Controls whether to apply the check to package-private member. |
| </td> |
| <td><a href="property_types.html#boolean">Boolean</a></td> |
| <td><code>true</code></td> |
| <td>5.0</td> |
| </tr> |
| <tr> |
| <td>applyToPrivate</td> |
| <td>Controls whether to apply the check to private member.</td> |
| <td><a href="property_types.html#boolean">Boolean</a></td> |
| <td><code>true</code></td> |
| <td>5.0</td> |
| </tr> |
| </table> |
| </subsection> |
| |
| <subsection name="Examples"> |
| <p> |
| Property <code>format</code> in module <code>ConstantName</code> |
| is used to specify names to be allowed. The following configuration |
| apart from names allowed by default allows <code>log</code> or |
| <code>logger</code>: |
| </p> |
| |
| <source> |
| <module name="ConstantName"> |
| <property name="format" |
| value="^log(ger)?|[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$"/> |
| </module> |
| </source> |
| </subsection> |
| |
| <subsection name="Example of Usage"> |
| <ul> |
| <li> |
| <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Asun_checks.xml+repo%3Acheckstyle%2Fcheckstyle+ConstantName"> |
| Sun Style</a> |
| </li> |
| <li> |
| <a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+ConstantName"> |
| Checkstyle Style</a> |
| </li> |
| </ul> |
| </subsection> |
| |
| <subsection name="Error Messages"> |
| <ul> |
| <li> |
| <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22name.invalidPattern%22"> |
| name.invalidPattern</a> |
| </li> |
| </ul> |
| <p> |
| All messages can be customized if the default message doesn't suit you. |
| Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to. |
| </p> |
| </subsection> |
| |
| <subsection name="Package"> |
| <p> com.puppycrawl.tools.checkstyle.checks.naming </p> |
| </subsection> |
| |
| <subsection name="Parent Module"> |
| <p> <a href="config.html#TreeWalker">TreeWalker</a> </p> |
| </subsection> |
| </section> |
| |
| <section name="InterfaceTypeParameterName"> |
| <subsection name="Description"> |
| <p>Since Checkstyle 5.8</p> |
| <p> |
| Validates identifiers for interface type parameters. |
| </p> |
| </subsection> |
| |
| <subsection name="Properties"> |
| <table> |
| <tr> |
| <th>name</th> |
| <th>description</th> |
| <th>type</th> |
| <th>default value</th> |
| <th>since</th> |
| </tr> |
| <tr> |
| <td>format</td> |
| <td>Specifies valid identifiers.</td> |
| <td><a href="property_types.html#regexp">Regular Expression</a></td> |
| <td><code>"^[A-Z]$"</code></td> |
| <td>5.8</td> |
| </tr> |
| </table> |
| </subsection> |
| |
| <subsection name="Examples"> |
| <p> |
| To configure the check: |
| </p> |
| <source> |
| <module name="InterfaceTypeParameterName"/> |
| </source> |
| </subsection> |
| |
| <subsection name="Example of Usage"> |
| <ul> |
| <li> |
| <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Agoogle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+InterfaceTypeParameterName"> |
| Google Style</a> |
| </li> |
| <li> |
| <a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+InterfaceTypeParameterName"> |
| Checkstyle Style</a> |
| </li> |
| </ul> |
| </subsection> |
| |
| <subsection name="Error Messages"> |
| <ul> |
| <li> |
| <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22name.invalidPattern%22"> |
| name.invalidPattern</a> |
| </li> |
| </ul> |
| <p> |
| All messages can be customized if the default message doesn't suit you. |
| Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to. |
| </p> |
| </subsection> |
| |
| <subsection name="Package"> |
| <p> com.puppycrawl.tools.checkstyle.checks.naming </p> |
| </subsection> |
| |
| <subsection name="Parent Module"> |
| <p> <a href="config.html#TreeWalker">TreeWalker</a> </p> |
| </subsection> |
| </section> |
| |
| <section name="LocalFinalVariableName"> |
| <subsection name="Description"> |
| <p>Since Checkstyle 3.0</p> |
| <p> |
| Validates identifiers for local, <code>final</code> variables, including |
| <code>catch</code> parameters and resources in <code>try</code> statements. |
| </p> |
| </subsection> |
| |
| <subsection name="Properties"> |
| <table> |
| <tr> |
| <th>name</th> |
| <th>description</th> |
| <th>type</th> |
| <th>default value</th> |
| <th>since</th> |
| </tr> |
| <tr> |
| <td>format</td> |
| <td>Specifies valid identifiers.</td> |
| <td><a href="property_types.html#regexp">Regular Expression</a></td> |
| <td><code>"^[a-z][a-zA-Z0-9]*$"</code></td> |
| <td>3.0</td> |
| </tr> |
| <tr> |
| <td>tokens</td> |
| <td>tokens to check</td> |
| <td> |
| subset of tokens |
| <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#VARIABLE_DEF">VARIABLE_DEF</a>, |
| <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#PARAMETER_DEF">PARAMETER_DEF</a>, |
| <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#RESOURCE">RESOURCE</a>. |
| </td> |
| <td> |
| <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#VARIABLE_DEF">VARIABLE_DEF</a>, |
| <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#PARAMETER_DEF">PARAMETER_DEF</a>, |
| <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#RESOURCE">RESOURCE</a>. |
| </td> |
| <td>3.0</td> |
| </tr> |
| </table> |
| </subsection> |
| |
| <subsection name="Examples"> |
| <p> |
| To configure the check: |
| </p> |
| <source> |
| <module name="LocalFinalVariableName"/> |
| </source> |
| </subsection> |
| |
| <subsection name="Example of Usage"> |
| <ul> |
| <li> |
| <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Asun_checks.xml+repo%3Acheckstyle%2Fcheckstyle+LocalFinalVariableName"> |
| Sun Style</a> |
| </li> |
| <li> |
| <a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+LocalFinalVariableName"> |
| Checkstyle Style</a> |
| </li> |
| </ul> |
| </subsection> |
| |
| <subsection name="Error Messages"> |
| <ul> |
| <li> |
| <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22name.invalidPattern%22"> |
| name.invalidPattern</a> |
| </li> |
| </ul> |
| <p> |
| All messages can be customized if the default message doesn't suit you. |
| Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to. |
| </p> |
| </subsection> |
| |
| <subsection name="Package"> |
| <p> com.puppycrawl.tools.checkstyle.checks.naming </p> |
| </subsection> |
| |
| <subsection name="Parent Module"> |
| <p> <a href="config.html#TreeWalker">TreeWalker</a> </p> |
| </subsection> |
| </section> |
| |
| <section name="LocalVariableName"> |
| <subsection name="Description"> |
| <p>Since Checkstyle 3.0</p> |
| <p> |
| Checks that local, non-<code>final</code> variable names conform to a format specified |
| by the format property. |
| </p> |
| </subsection> |
| |
| <subsection name="Properties"> |
| <table> |
| <tr> |
| <th>name</th> |
| <th>description</th> |
| <th>type</th> |
| <th>default value</th> |
| <th>since</th> |
| </tr> |
| <tr> |
| <td>format</td> |
| <td>Specifies valid identifiers.</td> |
| <td><a href="property_types.html#regexp">Regular Expression</a></td> |
| <td><code>"^[a-z][a-zA-Z0-9]*$"</code></td> |
| <td>3.0</td> |
| </tr> |
| <tr> |
| <td>allowOneCharVarInForLoop</td> |
| <td> |
| Allow one character variable name in <a href="https://docs.oracle.com/javase/tutorial/java/nutsandbolts/for.html"> initialization expressions</a> in FOR loop. For example: |
| <pre> |
| for (int i = 1; i < 10; i++) {} |
| </pre> |
| </td> |
| <td><a href="property_types.html#boolean">Boolean</a></td> |
| <td><code>false</code></td> |
| <td>5.8</td> |
| </tr> |
| </table> |
| </subsection> |
| |
| <subsection name="Examples"> |
| <p> |
| To configure the check to use the default configuration: |
| </p> |
| |
| <source> |
| <module name="LocalVariableName"/> |
| </source> |
| |
| <p> |
| An example of how to configure the check to allow one character variable name in |
| <a href="https://docs.oracle.com/javase/tutorial/java/nutsandbolts/for.html"> |
| initialization expressions</a> in FOR loop: |
| </p> |
| <source> |
| <module name="LocalVariableName"> |
| <property name="allowOneCharVarInForLoop" value="true"/> |
| </module> |
| </source> |
| </subsection> |
| |
| <subsection name="Example of Usage"> |
| <ul> |
| <li> |
| <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Agoogle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+LocalVariableName"> |
| Google Style</a> |
| </li> |
| <li> |
| <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Asun_checks.xml+repo%3Acheckstyle%2Fcheckstyle+LocalVariableName"> |
| Sun Style</a> |
| </li> |
| <li> |
| <a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+LocalVariableName"> |
| Checkstyle Style</a> |
| </li> |
| </ul> |
| </subsection> |
| |
| <subsection name="Error Messages"> |
| <ul> |
| <li> |
| <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22name.invalidPattern%22"> |
| name.invalidPattern</a> |
| </li> |
| </ul> |
| <p> |
| All messages can be customized if the default message doesn't suit you. |
| Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to. |
| </p> |
| </subsection> |
| |
| <subsection name="Package"> |
| <p> com.puppycrawl.tools.checkstyle.checks.naming </p> |
| </subsection> |
| |
| <subsection name="Parent Module"> |
| <p> <a href="config.html#TreeWalker">TreeWalker</a> </p> |
| </subsection> |
| </section> |
| |
| <section name="MemberName"> |
| <subsection name="Description"> |
| <p>Since Checkstyle 3.0</p> |
| <p> |
| Validates identifiers for non-<code>static</code> fields. |
| </p> |
| </subsection> |
| |
| <subsection name="Properties"> |
| <table> |
| <tr> |
| <th>name</th> |
| <th>description</th> |
| <th>type</th> |
| <th>default value</th> |
| <th>since</th> |
| </tr> |
| <tr> |
| <td>format</td> |
| <td>Specifies valid identifiers.</td> |
| <td><a href="property_types.html#regexp">Regular Expression</a></td> |
| <td><code>"^[a-z][a-zA-Z0-9]*$"</code></td> |
| <td>3.0</td> |
| </tr> |
| <tr> |
| <td>applyToPublic</td> |
| <td>Controls whether to apply the check to public member.</td> |
| <td><a href="property_types.html#boolean">Boolean</a></td> |
| <td><code>true</code></td> |
| <td>3.4</td> |
| </tr> |
| <tr> |
| <td>applyToProtected</td> |
| <td>Controls whether to apply the check to protected member.</td> |
| <td><a href="property_types.html#boolean">Boolean</a></td> |
| <td><code>true</code></td> |
| <td>3.4</td> |
| </tr> |
| <tr> |
| <td>applyToPackage</td> |
| <td> |
| Controls whether to apply the check to package-private member. |
| </td> |
| <td><a href="property_types.html#boolean">Boolean</a></td> |
| <td><code>true</code></td> |
| <td>3.4</td> |
| </tr> |
| <tr> |
| <td>applyToPrivate</td> |
| <td>Controls whether to apply the check to private member.</td> |
| <td><a href="property_types.html#boolean">Boolean</a></td> |
| <td><code>true</code></td> |
| <td>3.4</td> |
| </tr> |
| </table> |
| </subsection> |
| |
| <subsection name="Examples"> |
| <p> |
| This is an example of a |
| configuration of the <code>MemberName</code> module to |
| ensure that member identifiers begin with |
| <code>'m'</code>, followed |
| by an upper case letter, and then letters and digits: |
| </p> |
| |
| <source> |
| <module name="MemberName"> |
| <property name="format" value="^m[A-Z][a-zA-Z0-9]*$"/> |
| </module> |
| </source> |
| </subsection> |
| |
| <subsection name="Example of Usage"> |
| <ul> |
| <li> |
| <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Agoogle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+MemberName"> |
| Google Style</a> |
| </li> |
| <li> |
| <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Asun_checks.xml+repo%3Acheckstyle%2Fcheckstyle+MemberName"> |
| Sun Style</a> |
| </li> |
| <li> |
| <a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+MemberName"> |
| Checkstyle Style</a> |
| </li> |
| </ul> |
| </subsection> |
| |
| <subsection name="Error Messages"> |
| <ul> |
| <li> |
| <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22name.invalidPattern%22"> |
| name.invalidPattern</a> |
| </li> |
| </ul> |
| <p> |
| All messages can be customized if the default message doesn't suit you. |
| Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to. |
| </p> |
| </subsection> |
| |
| <subsection name="Package"> |
| <p> com.puppycrawl.tools.checkstyle.checks.naming </p> |
| </subsection> |
| |
| <subsection name="Parent Module"> |
| <p> <a href="config.html#TreeWalker">TreeWalker</a> </p> |
| </subsection> |
| </section> |
| |
| <section name="MethodName"> |
| <subsection name="Description"> |
| <p>Since Checkstyle 3.0</p> |
| <p> |
| Validates identifiers for methods. |
| </p> |
| </subsection> |
| |
| <subsection name="Properties"> |
| <table> |
| <tr> |
| <th>name</th> |
| <th>description</th> |
| <th>type</th> |
| <th>default value</th> |
| <th>since</th> |
| </tr> |
| <tr> |
| <td>format</td> |
| <td>Specifies valid identifiers.</td> |
| <td><a href="property_types.html#regexp">Regular Expression</a></td> |
| <td><code>"^[a-z][a-zA-Z0-9]*$"</code></td> |
| <td>3.0</td> |
| </tr> |
| <tr> |
| <td>allowClassName</td> |
| <td> |
| Controls whether to allow a method name to have the same |
| name as the residing class name. This is not to be confused |
| with a constructor. An easy mistake is to place a return |
| type on a constructor declaration which turns it into a |
| method. For example: |
| <pre> |
| class MyClass { |
| public void MyClass() {} //this is a method |
| public MyClass() {} //this is a constructor |
| } |
| </pre> |
| </td> |
| <td><a href="property_types.html#boolean">Boolean</a></td> |
| <td><code>false</code></td> |
| <td>5.0</td> |
| </tr> |
| <tr> |
| <td>applyToPublic</td> |
| <td>Controls whether to apply the check to public member.</td> |
| <td><a href="property_types.html#boolean">Boolean</a></td> |
| <td><code>true</code></td> |
| <td>5.1</td> |
| </tr> |
| <tr> |
| <td>applyToProtected</td> |
| <td>Controls whether to apply the check to protected member.</td> |
| <td><a href="property_types.html#boolean">Boolean</a></td> |
| <td><code>true</code></td> |
| <td>5.1</td> |
| </tr> |
| <tr> |
| <td>applyToPackage</td> |
| <td> |
| Controls whether to apply the check to package-private member. |
| </td> |
| <td><a href="property_types.html#boolean">Boolean</a></td> |
| <td><code>true</code></td> |
| <td>5.1</td> |
| </tr> |
| <tr> |
| <td>applyToPrivate</td> |
| <td>Controls whether to apply the check to private member.</td> |
| <td><a href="property_types.html#boolean">Boolean</a></td> |
| <td><code>true</code></td> |
| <td>5.1</td> |
| </tr> |
| </table> |
| </subsection> |
| |
| <subsection name="Examples"> |
| <p> |
| To configure the check: |
| </p> |
| <source> |
| <module name="MethodName"/> |
| </source> |
| </subsection> |
| |
| <subsection name="Example of Usage"> |
| <ul> |
| <li> |
| <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Agoogle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+MethodName"> |
| Google Style</a> |
| </li> |
| <li> |
| <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Asun_checks.xml+repo%3Acheckstyle%2Fcheckstyle+MethodName"> |
| Sun Style</a> |
| </li> |
| <li> |
| <a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+MethodName"> |
| Checkstyle Style</a> |
| </li> |
| </ul> |
| </subsection> |
| |
| <subsection name="Error Messages"> |
| <ul> |
| <li> |
| <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22method.name.equals.class.name%22"> |
| method.name.equals.class.name</a> |
| </li> |
| <li> |
| <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22name.invalidPattern%22"> |
| name.invalidPattern</a> |
| </li> |
| </ul> |
| <p> |
| All messages can be customized if the default message doesn't suit you. |
| Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to. |
| </p> |
| </subsection> |
| |
| <subsection name="Package"> |
| <p> com.puppycrawl.tools.checkstyle.checks.naming </p> |
| </subsection> |
| |
| <subsection name="Parent Module"> |
| <p> <a href="config.html#TreeWalker">TreeWalker</a> </p> |
| </subsection> |
| </section> |
| |
| <section name="MethodTypeParameterName"> |
| <subsection name="Description"> |
| <p>Since Checkstyle 5.0</p> |
| <p> |
| Validates identifiers for method type parameters. |
| </p> |
| </subsection> |
| |
| <subsection name="Properties"> |
| <table> |
| <tr> |
| <th>name</th> |
| <th>description</th> |
| <th>type</th> |
| <th>default value</th> |
| <th>since</th> |
| </tr> |
| <tr> |
| <td>format</td> |
| <td>Specifies valid identifiers.</td> |
| <td><a href="property_types.html#regexp">Regular Expression</a></td> |
| <td><code>"^[A-Z]$"</code></td> |
| <td>5.0</td> |
| </tr> |
| </table> |
| </subsection> |
| |
| <subsection name="Examples"> |
| <p> |
| To configure the check: |
| </p> |
| <source> |
| <module name="MethodTypeParameterName"/> |
| </source> |
| </subsection> |
| |
| <subsection name="Example of Usage"> |
| <ul> |
| <li> |
| <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Agoogle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+MethodTypeParameterName"> |
| Google Style</a> |
| </li> |
| <li> |
| <a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+MethodTypeParameterName"> |
| Checkstyle Style</a> |
| </li> |
| </ul> |
| </subsection> |
| |
| <subsection name="Error Messages"> |
| <ul> |
| <li> |
| <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22name.invalidPattern%22"> |
| name.invalidPattern</a> |
| </li> |
| </ul> |
| <p> |
| All messages can be customized if the default message doesn't suit you. |
| Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to. |
| </p> |
| </subsection> |
| |
| <subsection name="Package"> |
| <p> com.puppycrawl.tools.checkstyle.checks.naming </p> |
| </subsection> |
| |
| <subsection name="Parent Module"> |
| <p> <a href="config.html#TreeWalker">TreeWalker</a> </p> |
| </subsection> |
| </section> |
| |
| <section name="PackageName"> |
| <subsection name="Description"> |
| <p>Since Checkstyle 3.0</p> |
| <p> |
| Validates identifiers for packages. |
| </p> |
| </subsection> |
| |
| <subsection name="Properties"> |
| <table> |
| <tr> |
| <th>name</th> |
| <th>description</th> |
| <th>type</th> |
| <th>default value</th> |
| <th>since</th> |
| </tr> |
| <tr> |
| <td>format</td> |
| <td>Specifies valid identifiers.</td> |
| <td><a href="property_types.html#regexp">Regular Expression</a></td> |
| <td><code>"^[a-z]+(\.[a-zA-Z_][a-zA-Z0-9_]*)*$"</code></td> |
| <td>3.0</td> |
| </tr> |
| </table> |
| </subsection> |
| |
| <subsection name="Examples"> |
| <p> |
| The default value of <code>format</code> for module <code>PackageName</code> has been chosen to match the |
| requirements in the <a |
| href="https://docs.oracle.com/javase/specs/jls/se8/html/jls-6.html#jls-6.5.3">Java |
| Language specification</a> and the Sun coding conventions. However |
| both underscores and uppercase letters are rather uncommon, so most |
| configurations should probably assign value <code>^[a-z]+(\.[a-z][a-z0-9]*)*$</code> to <code>format</code> for module <code>PackageName</code>, as in |
| </p> |
| |
| <source> |
| <module name="PackageName"> |
| <property name="format" |
| value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/> |
| </module> |
| </source> |
| </subsection> |
| |
| <subsection name="Example of Usage"> |
| <ul> |
| <li> |
| <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Agoogle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+PackageName"> |
| Google Style</a> |
| </li> |
| <li> |
| <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Asun_checks.xml+repo%3Acheckstyle%2Fcheckstyle+PackageName"> |
| Sun Style</a> |
| </li> |
| <li> |
| <a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+PackageName"> |
| Checkstyle Style</a> |
| </li> |
| </ul> |
| </subsection> |
| |
| <subsection name="Error Messages"> |
| <ul> |
| <li> |
| <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22name.invalidPattern%22"> |
| name.invalidPattern</a> |
| </li> |
| </ul> |
| <p> |
| All messages can be customized if the default message doesn't suit you. |
| Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to. |
| </p> |
| </subsection> |
| |
| <subsection name="Package"> |
| <p> com.puppycrawl.tools.checkstyle.checks.naming </p> |
| </subsection> |
| |
| <subsection name="Parent Module"> |
| <p> <a href="config.html#TreeWalker">TreeWalker</a> </p> |
| </subsection> |
| </section> |
| |
| <section name="ParameterName"> |
| <subsection name="Description"> |
| <p>Since Checkstyle 3.0</p> |
| <p> |
| Checks that method and <code>catch</code> parameter names conform to a format specified |
| by the format property. By using <code>accessModifiers</code> property it is possible |
| to specify different formats for methods at different visibility levels. |
| </p> |
| </subsection> |
| |
| <subsection name="Properties"> |
| <table> |
| <tr> |
| <th>name</th> |
| <th>description</th> |
| <th>type</th> |
| <th>default value</th> |
| <th>since</th> |
| </tr> |
| <tr> |
| <td>format</td> |
| <td>Specifies valid identifiers.</td> |
| <td><a href="property_types.html#regexp">Regular Expression</a></td> |
| <td><code>"^[a-z][a-zA-Z0-9]*$"</code></td> |
| <td>3.0</td> |
| </tr> |
| <tr> |
| <td>ignoreOverridden</td> |
| <td> |
| Allows to skip methods with Override annotation from validation. For example, the |
| following method's parameter will be skipped from validation, if |
| ignoreOverridden is true: |
| <pre> |
| @Override |
| public boolean equals(Object o) { |
| return super.equals(o); |
| } |
| </pre> |
| </td> |
| <td><a href="property_types.html#boolean">Boolean</a></td> |
| <td><code>false</code></td> |
| <td>6.12.1</td> |
| </tr> |
| <tr> |
| <td>accessModifiers</td> |
| <td>Access modifiers of methods where parameters are checked.</td> |
| <td><a href="property_types.html#access_modifiers">Access Modifier Set</a></td> |
| <td><code>public, protected, package, private</code></td> |
| <td>7.5</td> |
| </tr> |
| </table> |
| </subsection> |
| |
| <subsection name="Examples"> |
| <p> |
| To configure the check: |
| </p> |
| <source> |
| <module name="ParameterName"/> |
| </source> |
| <p> |
| An example of how to configure the check to skip methods with Override annotation from |
| validation: |
| </p> |
| <source> |
| <module name="ParameterName"> |
| <property name="ignoreOverridden" value="true"/> |
| </module> |
| </source> |
| <p> |
| An example of how to configure the check for names that begin with |
| a lower case letter, followed by letters and digits is: |
| </p> |
| <source> |
| <module name="ParameterName"> |
| <property name="format" value="^[a-z][a-zA-Z0-9]+$"/> |
| </module> |
| </source> |
| <p> |
| The following configuration checks that the parameters always start with two |
| lowercase characters and, in addition, that public method parameters cannot be one character |
| long: |
| </p> |
| <source> |
| <module name="ParameterName"> |
| <property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/> |
| <property name="accessModifiers" value="protected, package, private"/> |
| <message key="name.invalidPattern" |
| value="Parameter name ''{0}'' must match pattern ''{1}''"/> |
| </module> |
| <module name="ParameterName"> |
| <property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/> |
| <property name="accessModifiers" value="public"/> |
| <message key="name.invalidPattern" |
| value="Parameter name ''{0}'' must match pattern ''{1}''"/> |
| </module> |
| </source> |
| </subsection> |
| |
| <subsection name="Example of Usage"> |
| <ul> |
| <li> |
| <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Agoogle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+ParameterName"> |
| Google Style</a> |
| </li> |
| <li> |
| <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Asun_checks.xml+repo%3Acheckstyle%2Fcheckstyle+ParameterName"> |
| Sun Style</a> |
| </li> |
| <li> |
| <a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+ParameterName"> |
| Checkstyle Style</a> |
| </li> |
| </ul> |
| </subsection> |
| |
| <subsection name="Error Messages"> |
| <ul> |
| <li> |
| <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22name.invalidPattern%22"> |
| name.invalidPattern</a> |
| </li> |
| </ul> |
| <p> |
| All messages can be customized if the default message doesn't suit you. |
| Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to. |
| </p> |
| </subsection> |
| |
| <subsection name="Package"> |
| <p> com.puppycrawl.tools.checkstyle.checks.naming </p> |
| </subsection> |
| |
| <subsection name="Parent Module"> |
| <p> <a href="config.html#TreeWalker">TreeWalker</a> </p> |
| </subsection> |
| </section> |
| |
| <section name="StaticVariableName"> |
| <subsection name="Description"> |
| <p>Since Checkstyle 3.0</p> |
| <p> |
| Validates identifiers for <code>static</code>, non-<code>final</code> fields. |
| </p> |
| </subsection> |
| |
| <subsection name="Properties"> |
| <table> |
| <tr> |
| <th>name</th> |
| <th>description</th> |
| <th>type</th> |
| <th>default value</th> |
| <th>since</th> |
| </tr> |
| <tr> |
| <td>format</td> |
| <td>Specifies valid identifiers.</td> |
| <td><a href="property_types.html#regexp">Regular Expression</a></td> |
| <td><code>"^[a-z][a-zA-Z0-9]*$"</code></td> |
| <td>3.0</td> |
| </tr> |
| <tr> |
| <td>applyToPublic</td> |
| <td>Controls whether to apply the check to public member.</td> |
| <td><a href="property_types.html#boolean">Boolean</a></td> |
| <td><code>true</code></td> |
| <td>5.0</td> |
| </tr> |
| <tr> |
| <td>applyToProtected</td> |
| <td>Controls whether to apply the check to protected member.</td> |
| <td><a href="property_types.html#boolean">Boolean</a></td> |
| <td><code>true</code></td> |
| <td>5.0</td> |
| </tr> |
| <tr> |
| <td>applyToPackage</td> |
| <td> |
| Controls whether to apply the check to package-private member. |
| </td> |
| <td><a href="property_types.html#boolean">Boolean</a></td> |
| <td><code>true</code></td> |
| <td>5.0</td> |
| </tr> |
| <tr> |
| <td>applyToPrivate</td> |
| <td>Controls whether to apply the check to private member.</td> |
| <td><a href="property_types.html#boolean">Boolean</a></td> |
| <td><code>true</code></td> |
| <td>5.0</td> |
| </tr> |
| </table> |
| </subsection> |
| |
| <subsection name="Examples"> |
| <p> |
| To configure the check: |
| </p> |
| <source> |
| <module name="StaticVariableName"/> |
| </source> |
| </subsection> |
| |
| <subsection name="Example of Usage"> |
| <ul> |
| <li> |
| <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Asun_checks.xml+repo%3Acheckstyle%2Fcheckstyle+StaticVariableName"> |
| Sun Style</a> |
| </li> |
| <li> |
| <a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+StaticVariableName"> |
| Checkstyle Style</a> |
| </li> |
| </ul> |
| </subsection> |
| |
| <subsection name="Error Messages"> |
| <ul> |
| <li> |
| <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22name.invalidPattern%22"> |
| name.invalidPattern</a> |
| </li> |
| </ul> |
| <p> |
| All messages can be customized if the default message doesn't suit you. |
| Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to. |
| </p> |
| </subsection> |
| |
| <subsection name="Package"> |
| <p> com.puppycrawl.tools.checkstyle.checks.naming </p> |
| </subsection> |
| |
| <subsection name="Parent Module"> |
| <p> <a href="config.html#TreeWalker">TreeWalker</a> </p> |
| </subsection> |
| </section> |
| |
| <section name="TypeName"> |
| <subsection name="Description"> |
| <p>Since Checkstyle 3.0</p> |
| <p> |
| Validates identifiers for classes, interfaces, enums, and annotations. |
| </p> |
| </subsection> |
| |
| <subsection name="Properties"> |
| <table> |
| <tr> |
| <th>name</th> |
| <th>description</th> |
| <th>type</th> |
| <th>default value</th> |
| <th>since</th> |
| </tr> |
| <tr> |
| <td>format</td> |
| <td>Specifies valid identifiers.</td> |
| <td><a href="property_types.html#regexp">Regular Expression</a></td> |
| <td><code>"^[A-Z][a-zA-Z0-9]*$"</code></td> |
| <td>3.0</td> |
| </tr> |
| <tr> |
| <td>applyToPublic</td> |
| <td>Controls whether to apply the check to public member.</td> |
| <td><a href="property_types.html#boolean">Boolean</a></td> |
| <td><code>true</code></td> |
| <td>5.0</td> |
| </tr> |
| <tr> |
| <td>applyToProtected</td> |
| <td>Controls whether to apply the check to protected member.</td> |
| <td><a href="property_types.html#boolean">Boolean</a></td> |
| <td><code>true</code></td> |
| <td>5.0</td> |
| </tr> |
| <tr> |
| <td>applyToPackage</td> |
| <td> |
| Controls whether to apply the check to package-private member. |
| </td> |
| <td><a href="property_types.html#boolean">Boolean</a></td> |
| <td><code>true</code></td> |
| <td>5.0</td> |
| </tr> |
| <tr> |
| <td>applyToPrivate</td> |
| <td>Controls whether to apply the check to private member.</td> |
| <td><a href="property_types.html#boolean">Boolean</a></td> |
| <td><code>true</code></td> |
| <td>5.0</td> |
| </tr> |
| <tr> |
| <td>tokens</td> |
| <td>tokens to check</td> |
| <td> |
| subset of tokens |
| <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#CLASS_DEF"> |
| CLASS_DEF</a>, |
| <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#INTERFACE_DEF"> |
| INTERFACE_DEF</a>, |
| <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ENUM_DEF"> |
| ENUM_DEF</a>, |
| <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ANNOTATION_DEF"> |
| ANNOTATION_DEF</a>. |
| </td> |
| <td> |
| <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#CLASS_DEF"> |
| CLASS_DEF</a>, |
| <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#INTERFACE_DEF"> |
| INTERFACE_DEF</a>, |
| <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ENUM_DEF"> |
| ENUM_DEF</a>, |
| <a href="apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#ANNOTATION_DEF"> |
| ANNOTATION_DEF</a>. |
| </td> |
| <td>3.0</td> |
| </tr> |
| </table> |
| </subsection> |
| |
| <subsection name="Examples"> |
| <p> |
| The following configuration element ensures that |
| interface names begin with <code>"I_"</code>, followed by |
| letters and digits: |
| </p> |
| |
| <source> |
| <module name="TypeName"> |
| <property name="format" |
| value="^I_[a-zA-Z0-9]*$"/> |
| <property name="tokens" |
| value="INTERFACE_DEF"/> |
| </module> |
| </source> |
| </subsection> |
| |
| <subsection name="Example of Usage"> |
| <ul> |
| <li> |
| <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Agoogle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+TypeName"> |
| Google Style</a> |
| </li> |
| <li> |
| <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+filename%3Asun_checks.xml+repo%3Acheckstyle%2Fcheckstyle+TypeName"> |
| Sun Style</a> |
| </li> |
| <li> |
| <a href="https://github.com/search?q=path%3Aconfig+filename%3Acheckstyle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+TypeName"> |
| Checkstyle Style</a> |
| </li> |
| </ul> |
| </subsection> |
| |
| <subsection name="Error Messages"> |
| <ul> |
| <li> |
| <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fnaming+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22name.invalidPattern%22"> |
| name.invalidPattern</a> |
| </li> |
| </ul> |
| <p> |
| All messages can be customized if the default message doesn't suit you. |
| Please <a href="config.html#Custom_messages">see the documentation</a> to learn how to. |
| </p> |
| </subsection> |
| |
| <subsection name="Package"> |
| <p> com.puppycrawl.tools.checkstyle.checks.naming </p> |
| </subsection> |
| |
| <subsection name="Parent Module"> |
| <p> <a href="config.html#TreeWalker">TreeWalker</a> </p> |
| </subsection> |
| </section> |
| |
| </body> |
| </document> |