Update rule documentation and changelog

This commit is contained in:
Clément Fournier
2018-03-27 14:09:36 +02:00
parent c7f5de7aa1
commit 600ff54187
2 changed files with 42 additions and 2 deletions

View File

@ -13,14 +13,36 @@ This is a minor release.
### Table Of Contents
* [New and noteworthy](#new-and-noteworthy)
* [Naming rules enhancements](#naming-rules-enhancements)
* [Fixed Issues](#fixed-issues)
* [API Changes](#api-changes)
* [Deprecated Rules](#deprecated-rules)
* [External Contributions](#external-contributions)
### New and noteworthy
#### Naming rules enhancements
* [`ClassNamingConventions`](pmd_rules_java_codestyle.html#classnamingconventions)
has been enhanced to allow granular configuration of naming
conventions for different kinds of type declarations (eg enum or abstract
class). Each kind of declaration can use its own naming convention
using a regex property. See the rule's documentation for more info about
configuration and default conventions.
### Fixed Issues
### API Changes
#### Deprecated Rules
* The Java rule `AbstractNaming` (category `codestyle`) is deprecated
in favour of [`ClassNamingConventions`](pmd_rules_java_codestyle.html#classnamingconventions).
See [Naming rules enhancements](#naming-rules-enhancements).
### External Contributions

View File

@ -12,6 +12,7 @@ Rules which enforce a specific coding style.
<rule name="AbstractNaming"
language="java"
since="1.4"
deprecated="true"
message="Abstract classes should be named 'AbstractXXX'"
class="net.sourceforge.pmd.lang.rule.XPathRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_codestyle.html#abstractnaming">
@ -374,12 +375,29 @@ public class Foo extends Bar{
class="net.sourceforge.pmd.lang.java.rule.codestyle.ClassNamingConventionsRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_codestyle.html#classnamingconventions">
<description>
Class names should always begin with an upper case character.
Configurable naming conventions for type declarations. This rule reports
type declarations which do not match the regex that applies to their
specific kind (e.g. enum or interface). Each regex can be configured through
properties.
By default this rule uses the standard Java naming convention (Pascal case),
and reports utility class names not ending with 'Util'.
</description>
<priority>1</priority>
<example>
<![CDATA[
public class Foo {}
// This is Pascal case, the recommended naming convention in Java
// Note that the default values of this rule don't allow numbers,
// underscores, or accented characters in type names
public class FooBar {}
// You may want abstract classes to be named 'AbstractXXX',
// in which case you can customize the regex for abstract
// classes to 'Abstract[A-Z]\w+'
public abstract class Thing {}
// This class doesn't respect the convention, and will be flagged
public class Éléphant {}
]]>
</example>
</rule>