diff options
author | Michal Kordas <kordas.michal@gmail.com> | 2015-11-17 23:38:59 +0100 |
---|---|---|
committer | Roman Ivanov <ivanov-jr@mail.ru> | 2015-12-03 15:16:44 -0800 |
commit | d67d10e9f2b480f7f56fe7cda2a908cd5fe770c7 (patch) | |
tree | 5dba940926dba715b51202e5105bc2a08d5447f2 /src/xdocs/config_naming.xml | |
parent | e9e8d2f0a76601762e59f4743f0df0c792bea44d (diff) | |
download | checkstyle-d67d10e9f2b480f7f56fe7cda2a908cd5fe770c7.tar.gz |
Issue #2616: Add CatchParameterName check for catch blocks parameters
Diffstat (limited to 'src/xdocs/config_naming.xml')
-rw-r--r-- | src/xdocs/config_naming.xml | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/src/xdocs/config_naming.xml b/src/xdocs/config_naming.xml index 03867b6e0..334a09b4d 100644 --- a/src/xdocs/config_naming.xml +++ b/src/xdocs/config_naming.xml @@ -230,6 +230,90 @@ </subsection> </section> + <section name="CatchParameterName"> + <subsection name="Description"> + <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> + </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> + </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="ParameterName"> + <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="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>Validates identifiers for class type parameters.</p> |