Skip to content

Commit

Permalink
Issue checkstyle#13693: migrate size modules to property marco
Browse files Browse the repository at this point in the history
  • Loading branch information
romani authored and rnveach committed Dec 15, 2023
1 parent 22eb9f6 commit aaead4b
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 133 deletions.
10 changes: 2 additions & 8 deletions config/checkstyle-non-main-files-suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -367,14 +367,8 @@
files="src[\\/]xdocs[\\/]checks[\\/]regexp[\\/]regexpsinglelinejava.xml.template"/>
<suppress id="propertiesMacroMustExist"
files="src[\\/]xdocs[\\/]checks[\\/]sizes[\\/]anoninnerlength.xml.template"/>
<suppress id="propertiesMacroMustExist"
files="src[\\/]xdocs[\\/]checks[\\/]sizes[\\/]executablestatementcount.xml.template"/>
<suppress id="propertiesMacroMustExist"
files="src[\\/]xdocs[\\/]checks[\\/]sizes[\\/]filelength.xml.template"/>
<suppress id="propertiesMacroMustExist"
files="src[\\/]xdocs[\\/]checks[\\/]sizes[\\/]lambdabodylength.xml.template"/>
<suppress id="propertiesMacroMustExist"
files="src[\\/]xdocs[\\/]checks[\\/]sizes[\\/]linelength.xml.template"/>


<!-- no properties by design -->
<suppress id="propertiesMacroMustExist"
files="src[\\/]xdocs[\\/]checks[\\/]design[\\/]finalclass.xml.template"/>
Expand Down
11 changes: 9 additions & 2 deletions src/main/java/com/puppycrawl/tools/checkstyle/site/SiteUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,15 @@ public final class SiteUtil {
*/
private static final String V824 = "8.24";

/**
* Frequent version.
*/
private static final String VERSION_3_0 = "3.0";

/**
* Map of properties whose since version is different from module version but
* are not specified in code because they are inherited from their super class(es).
* Until <a href="https://github.com/checkstyle/checkstyle/issues/14052">#14052</a>.
*/
private static final Map<String, String> SINCE_VERSION_FOR_INHERITED_PROPERTY = Map.ofEntries(
Map.entry("MissingDeprecatedCheck.violateExecutionOnNonTightHtml", V824),
Expand All @@ -209,8 +215,9 @@ public final class SiteUtil {
// until https://github.com/checkstyle/checkstyle/issues/14052
Map.entry("JavadocBlockTagLocationCheck.violateExecutionOnNonTightHtml", V824),
Map.entry("JavadocMissingLeadingAsteriskCheck.violateExecutionOnNonTightHtml", "8.38"),
Map.entry("ParenPadCheck.option", "3.0"),
Map.entry("TypecastParenPadCheck.option", VERSION_3_2)
Map.entry("ParenPadCheck.option", VERSION_3_0),
Map.entry("TypecastParenPadCheck.option", VERSION_3_2),
Map.entry("FileLengthCheck.fileExtensions", VERSION_5_0)
);

/** Map of all superclasses properties and their javadocs. */
Expand Down
20 changes: 4 additions & 16 deletions src/xdocs/checks/sizes/anoninnerlength.xml.template
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,10 @@

<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>max</td>
<td>Specify the maximum number of lines allowed.</td>
<td><a href="../../property_types.html#int">int</a></td>
<td><code>20</code></td>
<td>3.2</td>
</tr>
</table>
<macro name="properties">
<param name="modulePath"
value="src/main/java/com/puppycrawl/tools/checkstyle/checks/sizes/AnonInnerLengthCheck.java"/>
</macro>
</div>
</subsection>

Expand Down
31 changes: 15 additions & 16 deletions src/xdocs/checks/sizes/executablestatementcount.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,36 +32,35 @@
<tr>
<td>tokens</td>
<td>tokens to check</td>
<td>
subset of tokens
<td>subset of tokens
<a href="../../apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#CTOR_DEF">
CTOR_DEF</a>
CTOR_DEF</a>
, <a href="../../apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#METHOD_DEF">
METHOD_DEF</a>
METHOD_DEF</a>
, <a href="../../apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#INSTANCE_INIT">
INSTANCE_INIT</a>
INSTANCE_INIT</a>
, <a href="../../apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#STATIC_INIT">
STATIC_INIT</a>
STATIC_INIT</a>
, <a href="../../apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#COMPACT_CTOR_DEF">
COMPACT_CTOR_DEF</a>
COMPACT_CTOR_DEF</a>
, <a href="../../apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#LAMBDA">
LAMBDA</a>
.
LAMBDA</a>
.
</td>
<td>
<a href="../../apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#CTOR_DEF">
CTOR_DEF</a>
CTOR_DEF</a>
, <a href="../../apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#METHOD_DEF">
METHOD_DEF</a>
METHOD_DEF</a>
, <a href="../../apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#INSTANCE_INIT">
INSTANCE_INIT</a>
INSTANCE_INIT</a>
, <a href="../../apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#STATIC_INIT">
STATIC_INIT</a>
STATIC_INIT</a>
, <a href="../../apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#COMPACT_CTOR_DEF">
COMPACT_CTOR_DEF</a>
COMPACT_CTOR_DEF</a>
, <a href="../../apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#LAMBDA">
LAMBDA</a>
.
LAMBDA</a>
.
</td>
<td>3.2</td>
</tr>
Expand Down
56 changes: 4 additions & 52 deletions src/xdocs/checks/sizes/executablestatementcount.xml.template
Original file line number Diff line number Diff line change
Expand Up @@ -14,58 +14,10 @@

<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>max</td>
<td>Specify the maximum threshold allowed.</td>
<td><a href="../../property_types.html#int">int</a></td>
<td><code>30</code></td>
<td>3.2</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#CTOR_DEF">
CTOR_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#INSTANCE_INIT">
INSTANCE_INIT</a>
, <a href="../../apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#STATIC_INIT">
STATIC_INIT</a>
, <a href="../../apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#COMPACT_CTOR_DEF">
COMPACT_CTOR_DEF</a>
, <a href="../../apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#LAMBDA">
LAMBDA</a>
.
</td>
<td>
<a href="../../apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#CTOR_DEF">
CTOR_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#INSTANCE_INIT">
INSTANCE_INIT</a>
, <a href="../../apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#STATIC_INIT">
STATIC_INIT</a>
, <a href="../../apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#COMPACT_CTOR_DEF">
COMPACT_CTOR_DEF</a>
, <a href="../../apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#LAMBDA">
LAMBDA</a>
.
</td>
<td>3.2</td>
</tr>
</table>
<macro name="properties">
<param name="modulePath"
value="src/main/java/com/puppycrawl/tools/checkstyle/checks/sizes/ExecutableStatementCountCheck.java"/>
</macro>
</div>
</subsection>

Expand Down
27 changes: 4 additions & 23 deletions src/xdocs/checks/sizes/filelength.xml.template
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,10 @@

<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>fileExtensions</td>
<td>Specify the file type extension of files to process.</td>
<td><a href="../../property_types.html#String.5B.5D">String[]</a></td>
<td><code>all files</code></td>
<td>5.0</td>
</tr>
<tr>
<td>max</td>
<td>Specify the maximum number of lines allowed.</td>
<td><a href="../../property_types.html#int">int</a></td>
<td><code>2000</code></td>
<td>3.2</td>
</tr>
</table>
<macro name="properties">
<param name="modulePath"
value="src/main/java/com/puppycrawl/tools/checkstyle/checks/sizes/FileLengthCheck.java"/>
</macro>
</div>
</subsection>

Expand Down
20 changes: 4 additions & 16 deletions src/xdocs/checks/sizes/lambdabodylength.xml.template
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,10 @@

<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>max</td>
<td>Specify the maximum number of lines allowed.</td>
<td><a href="../../property_types.html#int">int</a></td>
<td><code>10</code></td>
<td>8.37</td>
</tr>
</table>
<macro name="properties">
<param name="modulePath"
value="src/main/java/com/puppycrawl/tools/checkstyle/checks/sizes/LambdaBodyLengthCheck.java"/>
</macro>
</div>
</subsection>

Expand Down

0 comments on commit aaead4b

Please sign in to comment.