Skip to content

Commit

Permalink
Refactor maven-checkstyle-plugin configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed Dec 27, 2024
1 parent 7b79da8 commit 2691a17
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
33 changes: 20 additions & 13 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@
<commons.jacoco.branchRatio>0.59</commons.jacoco.branchRatio>
<commons.jacoco.lineRatio>0.68</commons.jacoco.lineRatio>
<commons.jacoco.complexityRatio>0.58</commons.jacoco.complexityRatio>
<!-- Checkstyle -->
<checkstyle.header.file>${basedir}/src/conf/checkstyle/checkstyle-header.txt</checkstyle.header.file>
<checkstyle.config.file>${basedir}/src/conf/checkstyle/checkstyle.xml</checkstyle.config.file>
<checkstyle.suppress.file>${basedir}/src/conf/checkstyle/checkstyle-suppressions.xml</checkstyle.suppress.file>
<checkstyle.resourceExcludes>LICENSE.txt, NOTICE.txt, **/maven-archiver/pom.properties</checkstyle.resourceExcludes>
</properties>
<distributionManagement>
<site>
Expand All @@ -94,6 +99,21 @@
</scm>
<build>
<defaultGoal>clean verify apache-rat:check japicmp:cmp checkstyle:check pmd:check spotbugs:check javadoc:javadoc</defaultGoal>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${commons.checkstyle-plugin.version}</version>
<configuration>
<configLocation>${checkstyle.config.file}</configLocation>
<enableRulesSummary>false</enableRulesSummary>
<suppressionsLocation>${checkstyle.suppress.file}</suppressionsLocation>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
Expand Down Expand Up @@ -198,13 +218,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<configLocation>${basedir}/src/conf/checkstyle.xml</configLocation>
<!-- Needed to define config_loc -->
<propertyExpansion>config_loc=${basedir}</propertyExpansion>
<enableRulesSummary>false</enableRulesSummary>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
</configuration>
</plugin>
<plugin>
<groupId>com.github.siom79.japicmp</groupId>
Expand Down Expand Up @@ -259,12 +272,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<configLocation>${basedir}/src/conf/checkstyle.xml</configLocation>
<!-- Needed to define config_loc -->
<propertyExpansion>config_loc=${basedir}</propertyExpansion>
<enableRulesSummary>false</enableRulesSummary>
</configuration>
<!-- We need to specify reportSets because 2.9.1 creates two reports -->
<reportSets>
<reportSet>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<!DOCTYPE suppressions PUBLIC
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ limitations under the License.

<module name="SuppressionFilter">
<!-- config_loc is used by Eclipse plugin -->
<property name="file" value="${config_loc}/src/conf/checkstyle-suppressions.xml"/>
<property name="file" value="src/conf/checkstyle/checkstyle-suppressions.xml"/>
</module>
<module name="RegexpSingleline">
<!-- \s matches whitespace character, $ matches end of line. -->
Expand Down

0 comments on commit 2691a17

Please sign in to comment.