Skip to content

Commit

Permalink
Issue checkstyle#13693: migrate some imports modules to property marco
Browse files Browse the repository at this point in the history
  • Loading branch information
romani authored and rnveach committed Nov 19, 2023
1 parent 793ecfe commit e28b512
Show file tree
Hide file tree
Showing 12 changed files with 41 additions and 354 deletions.
12 changes: 0 additions & 12 deletions config/checkstyle-non-main-files-suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -258,20 +258,8 @@
files="src[\\/]xdocs[\\/]checks[\\/]header[\\/]header.xml.template"/>
<suppress id="propertiesMacroMustExist"
files="src[\\/]xdocs[\\/]checks[\\/]header[\\/]regexpheader.xml.template"/>
<suppress id="propertiesMacroMustExist"
files="src[\\/]xdocs[\\/]checks[\\/]imports[\\/]avoidstarimport.xml.template"/>
<suppress id="propertiesMacroMustExist"
files="src[\\/]xdocs[\\/]checks[\\/]imports[\\/]avoidstaticimport.xml.template"/>
<suppress id="propertiesMacroMustExist"
files="src[\\/]xdocs[\\/]checks[\\/]imports[\\/]customimportorder.xml.template"/>
<suppress id="propertiesMacroMustExist"
files="src[\\/]xdocs[\\/]checks[\\/]imports[\\/]illegalimport.xml.template"/>
<suppress id="propertiesMacroMustExist"
files="src[\\/]xdocs[\\/]checks[\\/]imports[\\/]importcontrol.xml.template"/>
<suppress id="propertiesMacroMustExist"
files="src[\\/]xdocs[\\/]checks[\\/]imports[\\/]importorder.xml.template"/>
<suppress id="propertiesMacroMustExist"
files="src[\\/]xdocs[\\/]checks[\\/]imports[\\/]unusedimports.xml.template"/>
<suppress id="propertiesMacroMustExist"
files="src[\\/]xdocs[\\/]checks[\\/]javadoc[\\/]atclauseorder.xml.template"/>
<suppress id="propertiesMacroMustExist"
Expand Down
16 changes: 3 additions & 13 deletions src/xdocs/checks/imports/avoidstarimport.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,31 +40,21 @@
</tr>
<tr>
<td>allowClassImports</td>
<td>
Control whether to allow starred class imports like
<code>import java.util.*;</code>.
</td>
<td>Control whether to allow starred class imports like <code>import java.util.*;</code>.</td>
<td><a href="../../property_types.html#boolean">boolean</a></td>
<td><code>false</code></td>
<td>5.3</td>
</tr>
<tr>
<td>allowStaticMemberImports</td>
<td>
Control whether to allow starred static member imports like
<code>import static org.junit.Assert.*;</code>.
</td>
<td>Control whether to allow starred static member imports like <code>import static org.junit.Assert.*;</code>.</td>
<td><a href="../../property_types.html#boolean">boolean</a></td>
<td><code>false</code></td>
<td>5.3</td>
</tr>
<tr>
<td>excludes</td>
<td>
Specify packages where starred class imports are
allowed and classes where starred static member imports are
allowed.
</td>
<td>Specify packages where starred class imports are allowed and classes where starred static member imports are allowed.</td>
<td><a href="../../property_types.html#String.5B.5D">String[]</a></td>
<td><code>{}</code></td>
<td>3.2</td>
Expand Down
44 changes: 4 additions & 40 deletions src/xdocs/checks/imports/avoidstarimport.xml.template
Original file line number Diff line number Diff line change
Expand Up @@ -30,46 +30,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>allowClassImports</td>
<td>
Control whether to allow starred class imports like
<code>import java.util.*;</code>.
</td>
<td><a href="../../property_types.html#boolean">boolean</a></td>
<td><code>false</code></td>
<td>5.3</td>
</tr>
<tr>
<td>allowStaticMemberImports</td>
<td>
Control whether to allow starred static member imports like
<code>import static org.junit.Assert.*;</code>.
</td>
<td><a href="../../property_types.html#boolean">boolean</a></td>
<td><code>false</code></td>
<td>5.3</td>
</tr>
<tr>
<td>excludes</td>
<td>
Specify packages where starred class imports are
allowed and classes where starred static member imports are
allowed.
</td>
<td><a href="../../property_types.html#String.5B.5D">String[]</a></td>
<td><code>{}</code></td>
<td>3.2</td>
</tr>
</table>
<macro name="properties">
<param name="modulePath"
value="src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/AvoidStarImportCheck.java"/>
</macro>
</div>
</subsection>

Expand Down
7 changes: 1 addition & 6 deletions src/xdocs/checks/imports/avoidstaticimport.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,7 @@
</tr>
<tr>
<td>excludes</td>
<td>
Control whether to allow for certain classes via a star notation to be
excluded such as <code>java.lang.Math.*</code> or specific static
members to be excluded like <code>java.lang.System.out</code> for a variable or
<code>java.lang.Math.random</code> for a method. See notes section for details.
</td>
<td>Control whether to allow for certain classes via a star notation to be excluded such as <code>java.lang.Math.*</code> or specific static members to be excluded like <code>java.lang.System.out</code> for a variable or <code>java.lang.Math.random</code> for a method. See notes section for details.</td>
<td><a href="../../property_types.html#String.5B.5D">String[]</a></td>
<td><code>{}</code></td>
<td>5.0</td>
Expand Down
25 changes: 4 additions & 21 deletions src/xdocs/checks/imports/avoidstaticimport.xml.template
Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,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>excludes</td>
<td>
Control whether to allow for certain classes via a star notation to be
excluded such as <code>java.lang.Math.*</code> or specific static
members to be excluded like <code>java.lang.System.out</code> for a variable or
<code>java.lang.Math.random</code> for a method. See notes section for details.
</td>
<td><a href="../../property_types.html#String.5B.5D">String[]</a></td>
<td><code>{}</code></td>
<td>5.0</td>
</tr>
</table>
<macro name="properties">
<param name="modulePath"
value="src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/AvoidStaticImportCheck.java"/>
</macro>
</div>
</subsection>

Expand Down
16 changes: 3 additions & 13 deletions src/xdocs/checks/imports/illegalimport.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,37 +37,27 @@
</tr>
<tr>
<td>illegalClasses</td>
<td>Specify class names to reject, if <b>regexp</b> property is not set, checks if
import equals class name. If <b>regexp</b> property is set, then list of class names
will be interpreted as regular expressions. Note, all properties for match will be
used.</td>
<td>Specify class names to reject, if <b>regexp</b> property is not set, checks if import equals class name. If <b>regexp</b> property is set, then list of class names will be interpreted as regular expressions. Note, all properties for match will be used.</td>
<td><a href="../../property_types.html#String.5B.5D">String[]</a></td>
<td><code>{}</code></td>
<td>7.8</td>
</tr>
<tr>
<td>illegalPkgs</td>
<td>Specify packages to reject, if <b>regexp</b> property is not set, checks if import
is the part of package. If <b>regexp</b> property is set, then list of packages will
be interpreted as regular expressions. Note, all properties for match will be used.
</td>
<td>Specify packages to reject, if <b>regexp</b> property is not set, checks if import is the part of package. If <b>regexp</b> property is set, then list of packages will be interpreted as regular expressions. Note, all properties for match will be used.</td>
<td><a href="../../property_types.html#String.5B.5D">String[]</a></td>
<td><code>sun</code></td>
<td>3.0</td>
</tr>
<tr>
<td>regexp</td>
<td>
Control whether the <code>illegalPkgs</code> and <code>illegalClasses</code>
should be interpreted as regular expressions.
</td>
<td>Control whether the <code>illegalPkgs</code> and <code>illegalClasses</code> should be interpreted as regular expressions.</td>
<td><a href="../../property_types.html#boolean">boolean</a></td>
<td><code>false</code></td>
<td>7.8</td>
</tr>
</table>
</div>

</subsection>

<subsection name="Examples" id="Examples">
Expand Down
44 changes: 4 additions & 40 deletions src/xdocs/checks/imports/illegalimport.xml.template
Original file line number Diff line number Diff line change
Expand Up @@ -27,47 +27,11 @@

<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>illegalClasses</td>
<td>Specify class names to reject, if <b>regexp</b> property is not set, checks if
import equals class name. If <b>regexp</b> property is set, then list of class names
will be interpreted as regular expressions. Note, all properties for match will be
used.</td>
<td><a href="../../property_types.html#String.5B.5D">String[]</a></td>
<td><code>{}</code></td>
<td>7.8</td>
</tr>
<tr>
<td>illegalPkgs</td>
<td>Specify packages to reject, if <b>regexp</b> property is not set, checks if import
is the part of package. If <b>regexp</b> property is set, then list of packages will
be interpreted as regular expressions. Note, all properties for match will be used.
</td>
<td><a href="../../property_types.html#String.5B.5D">String[]</a></td>
<td><code>sun</code></td>
<td>3.0</td>
</tr>
<tr>
<td>regexp</td>
<td>
Control whether the <code>illegalPkgs</code> and <code>illegalClasses</code>
should be interpreted as regular expressions.
</td>
<td><a href="../../property_types.html#boolean">boolean</a></td>
<td><code>false</code></td>
<td>7.8</td>
</tr>
</table>
<macro name="properties">
<param name="modulePath"
value="src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/IllegalImportCheck.java"/>
</macro>
</div>

</subsection>

<subsection name="Examples" id="Examples">
Expand Down
12 changes: 2 additions & 10 deletions src/xdocs/checks/imports/importcontrol.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,22 +102,14 @@
</tr>
<tr>
<td>file</td>
<td>
Specify the location of the file containing the import control configuration.
It can be a regular file, URL or resource path. It will try loading
the path as a URL first, then as a file, and finally as a resource.
</td>
<td>Specify the location of the file containing the import control configuration. It can be a regular file, URL or resource path. It will try loading the path as a URL first, then as a file, and finally as a resource.</td>
<td><a href="../../property_types.html#URI">URI</a></td>
<td><code>null</code></td>
<td>4.0</td>
</tr>
<tr>
<td>path</td>
<td>
Specify the regular expression of file paths to which this check should apply. Files
that don't match the pattern will not be checked. The pattern will be matched
against the full absolute file path.
</td>
<td>Specify the regular expression of file paths to which this check should apply. Files that don't match the pattern will not be checked. The pattern will be matched against the full absolute file path.</td>
<td><a href="../../property_types.html#Pattern">Pattern</a></td>
<td><code>&quot;.*&quot;</code></td>
<td>7.5</td>
Expand Down
35 changes: 4 additions & 31 deletions src/xdocs/checks/imports/importcontrol.xml.template
Original file line number Diff line number Diff line change
Expand Up @@ -92,37 +92,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>file</td>
<td>
Specify the location of the file containing the import control configuration.
It can be a regular file, URL or resource path. It will try loading
the path as a URL first, then as a file, and finally as a resource.
</td>
<td><a href="../../property_types.html#URI">URI</a></td>
<td><code>null</code></td>
<td>4.0</td>
</tr>
<tr>
<td>path</td>
<td>
Specify the regular expression of file paths to which this check should apply. Files
that don't match the pattern will not be checked. The pattern will be matched
against the full absolute file path.
</td>
<td><a href="../../property_types.html#Pattern">Pattern</a></td>
<td><code>".*"</code></td>
<td>7.5</td>
</tr>
</table>
<macro name="properties">
<param name="modulePath"
value="src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlCheck.java"/>
</macro>
</div>
</subsection>

Expand Down
Loading

0 comments on commit e28b512

Please sign in to comment.