Skip to content

Commit

Permalink
Issue checkstyle#13693: migrate more modules to property macros
Browse files Browse the repository at this point in the history
  • Loading branch information
romani authored and nrmancuso committed Dec 30, 2023
1 parent 45d57f2 commit 6713ae3
Show file tree
Hide file tree
Showing 27 changed files with 108 additions and 482 deletions.
14 changes: 0 additions & 14 deletions config/checkstyle-non-main-files-suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -289,20 +289,6 @@
files="src[\\/]xdocs[\\/]checks[\\/]misc[\\/]uncommentedmain.xml.template"/>
<suppress id="propertiesMacroMustExist"
files="src[\\/]xdocs[\\/]checks[\\/]misc[\\/]uniqueproperties.xml.template"/>
<suppress id="propertiesMacroMustExist"
files="src[\\/]xdocs[\\/]checks[\\/]modifier[\\/]classmemberimpliedmodifier.xml.template"/>
<suppress id="propertiesMacroMustExist"
files="src[\\/]xdocs[\\/]checks[\\/]modifier[\\/]interfacememberimpliedmodifier.xml.template"/>
<suppress id="propertiesMacroMustExist"
files="src[\\/]xdocs[\\/]checks[\\/]modifier[\\/]redundantmodifier.xml.template"/>
<suppress id="propertiesMacroMustExist"
files="src[\\/]xdocs[\\/]checks[\\/]naming[\\/]abbreviationaswordinname.xml.template"/>
<suppress id="propertiesMacroMustExist"
files="src[\\/]xdocs[\\/]checks[\\/]naming[\\/]abstractclassname.xml.template"/>
<suppress id="propertiesMacroMustExist"
files="src[\\/]xdocs[\\/]checks[\\/]naming[\\/]catchparametername.xml.template"/>
<suppress id="propertiesMacroMustExist"
files="src[\\/]xdocs[\\/]checks[\\/]naming[\\/]classtypeparametername.xml.template"/>
<suppress id="propertiesMacroMustExist"
files="src[\\/]xdocs[\\/]checks[\\/]naming[\\/]constantname.xml.template"/>
<suppress id="propertiesMacroMustExist"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ protected AbstractNameCheck(String format) {
protected abstract boolean mustCheckName(DetailAST ast);

/**
* Set the format for the specified regular expression.
* Sets the pattern to match valid identifiers.
*
* @param pattern the new pattern
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
* </ul>
* <ul>
* <li>
* Property {@code format} - Specifies valid identifiers.
* Property {@code format} - Sets the pattern to match valid identifiers.
* Type is {@code java.util.regex.Pattern}.
* Default value is {@code "^(e|t|ex|[a-z][a-z][a-zA-Z]+)$"}.
* </li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* </p>
* <ul>
* <li>
* Property {@code format} - Specifies valid identifiers.
* Property {@code format} - Sets the pattern to match valid identifiers.
* Type is {@code java.util.regex.Pattern}.
* Default value is {@code "^[A-Z]$"}.
* </li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
* Default value is {@code true}.
* </li>
* <li>
* Property {@code format} - Set the format for the specified regular expression.
* Property {@code format} - Sets the pattern to match valid identifiers.
* Type is {@code java.util.regex.Pattern}.
* Default value is {@code "^[a-z][a-zA-Z0-9]*$"}.
* </li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
* Default value is {@code true}.
* </li>
* <li>
* Property {@code format} - Set the format for the specified regular expression.
* Property {@code format} - Sets the pattern to match valid identifiers.
* Type is {@code java.util.regex.Pattern}.
* Default value is {@code "^[A-Z][a-zA-Z0-9]*$"}.
* </li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,12 @@ public final class SiteUtil {
Map.entry("TypeNameCheck.applyToPrivate", VERSION_5_0),
Map.entry("TypeNameCheck.applyToProtected", VERSION_5_0),
Map.entry("TypeNameCheck.applyToPublic", VERSION_5_0),
Map.entry("TypeNameCheck.format", VERSION_3_0),
Map.entry("RegexpMultilineCheck.fileExtensions", VERSION_5_0),
Map.entry("RegexpOnFilenameCheck.fileExtensions", "6.15"),
Map.entry("RegexpSinglelineCheck.fileExtensions", VERSION_5_0)
Map.entry("RegexpSinglelineCheck.fileExtensions", VERSION_5_0),
Map.entry("ClassTypeParameterNameCheck.format", VERSION_5_0),
Map.entry("CatchParameterNameCheck.format", "6.14"),
Map.entry("TypeNameCheck.format", VERSION_3_0)
);

/** Map of all superclasses properties and their javadocs. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<property default-value="^(e|t|ex|[a-z][a-z][a-zA-Z]+)$"
name="format"
type="java.util.regex.Pattern">
<description>Specifies valid identifiers.</description>
<description>Sets the pattern to match valid identifiers.</description>
</property>
</properties>
<message-keys>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<property default-value="^[A-Z]$"
name="format"
type="java.util.regex.Pattern">
<description>Specifies valid identifiers.</description>
<description>Sets the pattern to match valid identifiers.</description>
</property>
</properties>
<message-keys>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<property default-value="^[a-z][a-zA-Z0-9]*$"
name="format"
type="java.util.regex.Pattern">
<description>Set the format for the specified regular expression.</description>
<description>Sets the pattern to match valid identifiers.</description>
</property>
</properties>
<message-keys>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<property default-value="^[A-Z][a-zA-Z0-9]*$"
name="format"
type="java.util.regex.Pattern">
<description>Set the format for the specified regular expression.</description>
<description>Sets the pattern to match valid identifiers.</description>
</property>
<property default-value="CLASS_DEF,INTERFACE_DEF,ENUM_DEF,ANNOTATION_DEF,RECORD_DEF"
name="tokens"
Expand Down
12 changes: 3 additions & 9 deletions src/xdocs/checks/modifier/classmemberimpliedmodifier.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,27 +51,21 @@ public final class Person {
</tr>
<tr>
<td>violateImpliedStaticOnNestedEnum</td>
<td>
Control whether to enforce that <code>static</code> is explicitly coded
on nested enums in classes and records.</td>
<td>Control whether to enforce that <code>static</code> is explicitly coded on nested enums in classes and records.</td>
<td><a href="../../property_types.html#boolean">boolean</a></td>
<td><code>true</code></td>
<td>8.16</td>
</tr>
<tr>
<td>violateImpliedStaticOnNestedInterface</td>
<td>
Control whether to enforce that <code>static</code> is explicitly coded
on nested interfaces in classes and records.</td>
<td>Control whether to enforce that <code>static</code> is explicitly coded on nested interfaces in classes and records.</td>
<td><a href="../../property_types.html#boolean">boolean</a></td>
<td><code>true</code></td>
<td>8.16</td>
</tr>
<tr>
<td>violateImpliedStaticOnNestedRecord</td>
<td>
Control whether to enforce that <code>static</code> is explicitly coded
on nested records in classes and records.</td>
<td>Control whether to enforce that <code>static</code> is explicitly coded on nested records in classes and records.</td>
<td><a href="../../property_types.html#boolean">boolean</a></td>
<td><code>true</code></td>
<td>8.36</td>
Expand Down
40 changes: 4 additions & 36 deletions src/xdocs/checks/modifier/classmemberimpliedmodifier.xml.template
Original file line number Diff line number Diff line change
Expand Up @@ -41,42 +41,10 @@ public final class Person {

<subsection name="Properties" id="Properties">
<div class="wrapper">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
<th>since</th>
</tr>
<tr>
<td>violateImpliedStaticOnNestedEnum</td>
<td>
Control whether to enforce that <code>static</code> is explicitly coded
on nested enums in classes and records.</td>
<td><a href="../../property_types.html#boolean">boolean</a></td>
<td><code>true</code></td>
<td>8.16</td>
</tr>
<tr>
<td>violateImpliedStaticOnNestedInterface</td>
<td>
Control whether to enforce that <code>static</code> is explicitly coded
on nested interfaces in classes and records.</td>
<td><a href="../../property_types.html#boolean">boolean</a></td>
<td><code>true</code></td>
<td>8.16</td>
</tr>
<tr>
<td>violateImpliedStaticOnNestedRecord</td>
<td>
Control whether to enforce that <code>static</code> is explicitly coded
on nested records in classes and records.</td>
<td><a href="../../property_types.html#boolean">boolean</a></td>
<td><code>true</code></td>
<td>8.36</td>
</tr>
</table>
<macro name="properties">
<param name="modulePath"
value="src/main/java/com/puppycrawl/tools/checkstyle/checks/modifier/ClassMemberImpliedModifierCheck.java"/>
</macro>
</div>
</subsection>

Expand Down
28 changes: 7 additions & 21 deletions src/xdocs/checks/modifier/interfacememberimpliedmodifier.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,63 +93,49 @@ public interface AddressFactory {
</tr>
<tr>
<td>violateImpliedAbstractMethod</td>
<td>
Control whether to enforce that <code>abstract</code> is explicitly coded
on interface methods.</td>
<td>Control whether to enforce that <code>abstract</code> is explicitly coded on interface methods.</td>
<td><a href="../../property_types.html#boolean">boolean</a></td>
<td><code>true</code></td>
<td>8.12</td>
</tr>
<tr>
<td>violateImpliedFinalField</td>
<td>
Control whether to enforce that <code>final</code> is explicitly coded
on interface fields.</td>
<td>Control whether to enforce that <code>final</code> is explicitly coded on interface fields.</td>
<td><a href="../../property_types.html#boolean">boolean</a></td>
<td><code>true</code></td>
<td>8.12</td>
</tr>
<tr>
<td>violateImpliedPublicField</td>
<td>
Control whether to enforce that <code>public</code> is explicitly coded
on interface fields.</td>
<td>Control whether to enforce that <code>public</code> is explicitly coded on interface fields.</td>
<td><a href="../../property_types.html#boolean">boolean</a></td>
<td><code>true</code></td>
<td>8.12</td>
</tr>
<tr>
<td>violateImpliedPublicMethod</td>
<td>
Control whether to enforce that <code>public</code> is explicitly coded
on interface methods.</td>
<td>Control whether to enforce that <code>public</code> is explicitly coded on interface methods.</td>
<td><a href="../../property_types.html#boolean">boolean</a></td>
<td><code>true</code></td>
<td>8.12</td>
</tr>
<tr>
<td>violateImpliedPublicNested</td>
<td>
Control whether to enforce that <code>public</code> is explicitly coded
on interface nested types.</td>
<td>Control whether to enforce that <code>public</code> is explicitly coded on interface nested types.</td>
<td><a href="../../property_types.html#boolean">boolean</a></td>
<td><code>true</code></td>
<td>8.12</td>
</tr>
<tr>
<td>violateImpliedStaticField</td>
<td>
Control whether to enforce that <code>static</code> is explicitly coded
on interface fields.</td>
<td>Control whether to enforce that <code>static</code> is explicitly coded on interface fields.</td>
<td><a href="../../property_types.html#boolean">boolean</a></td>
<td><code>true</code></td>
<td>8.12</td>
</tr>
<tr>
<td>violateImpliedStaticNested</td>
<td>
Control whether to enforce that <code>static</code> is explicitly coded
on interface nested types.</td>
<td>Control whether to enforce that <code>static</code> is explicitly coded on interface nested types.</td>
<td><a href="../../property_types.html#boolean">boolean</a></td>
<td><code>true</code></td>
<td>8.12</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,78 +83,10 @@ public interface AddressFactory {

<subsection name="Properties" id="Properties">
<div class="wrapper">
<table>
<tr>
<th>name</th>
<th>description</th>
<th>type</th>
<th>default value</th>
<th>since</th>
</tr>
<tr>
<td>violateImpliedAbstractMethod</td>
<td>
Control whether to enforce that <code>abstract</code> is explicitly coded
on interface methods.</td>
<td><a href="../../property_types.html#boolean">boolean</a></td>
<td><code>true</code></td>
<td>8.12</td>
</tr>
<tr>
<td>violateImpliedFinalField</td>
<td>
Control whether to enforce that <code>final</code> is explicitly coded
on interface fields.</td>
<td><a href="../../property_types.html#boolean">boolean</a></td>
<td><code>true</code></td>
<td>8.12</td>
</tr>
<tr>
<td>violateImpliedPublicField</td>
<td>
Control whether to enforce that <code>public</code> is explicitly coded
on interface fields.</td>
<td><a href="../../property_types.html#boolean">boolean</a></td>
<td><code>true</code></td>
<td>8.12</td>
</tr>
<tr>
<td>violateImpliedPublicMethod</td>
<td>
Control whether to enforce that <code>public</code> is explicitly coded
on interface methods.</td>
<td><a href="../../property_types.html#boolean">boolean</a></td>
<td><code>true</code></td>
<td>8.12</td>
</tr>
<tr>
<td>violateImpliedPublicNested</td>
<td>
Control whether to enforce that <code>public</code> is explicitly coded
on interface nested types.</td>
<td><a href="../../property_types.html#boolean">boolean</a></td>
<td><code>true</code></td>
<td>8.12</td>
</tr>
<tr>
<td>violateImpliedStaticField</td>
<td>
Control whether to enforce that <code>static</code> is explicitly coded
on interface fields.</td>
<td><a href="../../property_types.html#boolean">boolean</a></td>
<td><code>true</code></td>
<td>8.12</td>
</tr>
<tr>
<td>violateImpliedStaticNested</td>
<td>
Control whether to enforce that <code>static</code> is explicitly coded
on interface nested types.</td>
<td><a href="../../property_types.html#boolean">boolean</a></td>
<td><code>true</code></td>
<td>8.12</td>
</tr>
</table>
<macro name="properties">
<param name="modulePath"
value="src/main/java/com/puppycrawl/tools/checkstyle/checks/modifier/InterfaceMemberImpliedModifierCheck.java"/>
</macro>
</div>
</subsection>

Expand Down
Loading

0 comments on commit 6713ae3

Please sign in to comment.