You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2022/09/15 08:20:55 UTC
[tomcat-jakartaee-migration] 02/03: Add Checkstyle to build - configuration based on Tomcat 10.1.x
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat-jakartaee-migration.git
commit 41a9060cd0fde5d4e70f781d2581c894c1381146
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Sep 15 09:20:38 2022 +0100
Add Checkstyle to build - configuration based on Tomcat 10.1.x
---
pom.xml | 21 ++++++++++
res/checkstyle/checkstyle.xml | 93 +++++++++++++++++++++++++++++++++++++++++++
res/checkstyle/header-al2.txt | 19 +++++++++
3 files changed, 133 insertions(+)
diff --git a/pom.xml b/pom.xml
index 18a5ca6..8a92cf2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -320,6 +320,27 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <version>3.2.0</version>
+ <configuration>
+ <configLocation>res/checkstyle/checkstyle.xml</configLocation>
+ <headerLocation>res/checkstyle/header-al2.txt</headerLocation>
+ <consoleOutput>true</consoleOutput>
+ <failsOnError>true</failsOnError>
+ <linkXRef>false</linkXRef>
+ </configuration>
+ <executions>
+ <execution>
+ <id>validate</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
diff --git a/res/checkstyle/checkstyle.xml b/res/checkstyle/checkstyle.xml
new file mode 100644
index 0000000..f79466a
--- /dev/null
+++ b/res/checkstyle/checkstyle.xml
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ 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 module PUBLIC
+ "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
+ "https://checkstyle.org/dtds/configuration_1_3.dtd">
+<module name="Checker">
+ <!-- When adding checks, keep to the order checks are listed under -->
+ <!-- 'Standard Checks' in the Checkstyle documentation: -->
+ <!-- http://checkstyle.sourceforge.net/config_coding.html -->
+
+ <!-- Headers -->
+ <module name="RegexpHeader">
+ <property name="headerFile" value="${checkstyle.header.file}"/>
+ <property name="multiLines" value="1, 2, 3, 4"/>
+ <property name="fileExtensions" value="java,xml,jsp,txt,sh,bat,properties,yaml"/>
+ </module>
+
+ <!-- Whitespace -->
+ <module name="FileTabCharacter"/>
+ <module name="RegexpSingleline">
+ <!-- No trailing whitespace -->
+ <property name="format" value="\s+$"/>
+ </module>
+
+ <module name="TreeWalker">
+
+ <!-- Annotations -->
+ <module name="AnnotationLocation"/>
+ <module name="AnnotationUseStyle"/>
+ <module name="MissingOverride"/>
+ <module name="PackageAnnotation"/>
+
+ <!-- Block Checks -->
+ <module name="AvoidNestedBlocks">
+ <property name="allowInSwitchCase" value="true"/>
+ </module>
+ <module name="NeedBraces"/>
+
+ <!-- Coding -->
+ <module name="IllegalInstantiation"/>
+
+ <!-- Imports -->
+ <module name="AvoidStarImport"/>
+ <module name="AvoidStaticImport">
+ <property name="excludes" value="org.apache.catalina.startup.SimpleHttpClient.CRLF"/>
+ <property name="excludes" value="org.hamcrest.MatcherAssert.*"/>
+ <property name="excludes" value="org.hamcrest.core.IsInstanceOf.*"/>
+ </module>
+ <module name="IllegalImport">
+ <property name="illegalPkgs" value="sun,junit.framework"/>
+ </module>
+ <module name="ImportOrder">
+ <property name="groups" value="java,javax,jakarta,org.hamcrest,org.junit,org,async,jsp2,util"/>
+ <property name="ordered" value="true"/>
+ <property name="separated" value="true"/>
+ <property name="option" value="above"/>
+ </module>
+ <module name="RedundantImport"/>
+ <module name="UnusedImports"/>
+
+ <!-- Miscellaneous -->
+ <module name="Indentation">
+ <property name="lineWrappingIndentation" value="8"/>
+ </module>
+
+ <!-- Modifiers -->
+ <module name="ModifierOrder"/>
+ <module name="RedundantModifier"/>
+
+ <!-- Whitespace -->
+ <module name="GenericWhitespace"/>
+ <module name="EmptyForInitializerPad"/>
+ <module name="EmptyForIteratorPad"/>
+ <module name="OperatorWrap">
+ <property name="option" value="eol"/>
+ </module>
+ </module>
+</module>
diff --git a/res/checkstyle/header-al2.txt b/res/checkstyle/header-al2.txt
new file mode 100644
index 0000000..7234793
--- /dev/null
+++ b/res/checkstyle/header-al2.txt
@@ -0,0 +1,19 @@
+^<\?xml.*>$
+^@echo off$
+^#!
+^\W*$
+^(rem)?\W*Licensed to the Apache Software Foundation \(ASF\) under one or more$
+^(rem)?\W*contributor license agreements\. See the NOTICE file distributed with$
+^(rem)?\W*this work for additional information regarding copyright ownership\.$
+^(rem)?\W*The ASF licenses this file to You under the Apache License, Version 2\.0$
+^(rem)?\W*\(the "License"\); you may not use this file except in compliance with$
+^(rem)?\W*the License\. You may obtain a copy of the License at$
+^(rem)?\W*$
+^(rem)?\W*http://www.apache.org/licenses/LICENSE-2\.0$
+^(rem)?\W*$
+^(rem)?\W*Unless required by applicable law or agreed to in writing, software$
+^(rem)?\W*distributed under the License is distributed on an "AS IS" BASIS,$
+^(rem)?\W*WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.$
+^(rem)?\W*See the License for the specific language governing permissions and$
+^(rem)?\W*limitations under the License\.$
+^(rem)?\W*$
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org