Add code checking tool maven-checkstyle-plugin (#755)

pull/762/head
chen.ma 2 years ago
parent 00440506c2
commit eaf0fa16a7

@ -0,0 +1,130 @@
<?xml version="1.0"?>
<!--
~ 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
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<module name="Checker">
<module name="NewlineAtEndOfFile"/>
<module name="RegexpSingleline">
<property name="format" value="printStackTrace"/>
<property name="message" value="Prohibit invoking printStackTrace in source code !"/>
</module>
<module name="TreeWalker">
<module name="AvoidStarImport">
<property name="excludes" value="java.io,java.net,java.lang.Math"/>
<property name="allowClassImports" value="false"/>
<property name="allowStaticMemberImports" value="true"/>
</module>
<module name="IllegalImport"/>
<module name="RedundantImport"/>
<module name="UnusedImports"/>
<module name="JavadocType">
<property name="allowUnknownTags" value="true"/>
<property name="allowMissingParamTags" value="true"/>
<message key="javadoc.missing" value="Class Comments: Missing Javadoc Comments"/>
</module>
<!-- Do not scan method annotations for now -->
<!--<module name="JavadocMethod">
<property name="tokens" value="METHOD_DEF"/>
<property name="allowMissingPropertyJavadoc" value="true"/>
<message key="javadoc.missing" value="Method Comments: Missing Javadoc Comments"/>
</module>-->
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName"/>
<module name="PackageName">
<property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$" />
</module>
<module name="StaticVariableName"/>
<module name="TypeName"/>
<module name="MemberName"/>
<module name="MethodName"/>
<module name="ParameterName "/>
<module name="ConstantName"/>
<module name="ArrayTypeStyle"/>
<module name="UpperEll"/>
<module name="LineLength">
<property name="max" value="200"/>
</module>
<module name="MethodLength">
<property name="tokens" value="METHOD_DEF"/>
<property name="max" value="150"/>
</module>
<module name="ParameterNumber">
<property name="max" value="5"/>
<property name="ignoreOverriddenMethods" value="true"/>
<property name="tokens" value="METHOD_DEF"/>
</module>
<module name="MethodParamPad"/>
<module name="TypecastParenPad"/>
<module name="NoWhitespaceAfter"/>
<module name="NoWhitespaceBefore"/>
<module name="OperatorWrap"/>
<module name="ParenPad"/>
<module name="WhitespaceAfter"/>
<module name="WhitespaceAround"/>
<module name="ModifierOrder"/>
<module name="RedundantModifier"/>
<module name="AvoidNestedBlocks"/>
<module name="EmptyBlock"/>
<module name="LeftCurly"/>
<module name="NeedBraces"/>
<module name="RightCurly"/>
<module name="EmptyStatement"/>
<module name="EqualsHashCode"/>
<module name="IllegalInstantiation"/>
<module name="InnerAssignment"/>
<module name="MagicNumber">
<property name="ignoreNumbers" value="0, 1, 2"/>
<property name="ignoreAnnotation" value="true"/>
<property name="ignoreHashCodeMethod" value="true"/>
<property name="ignoreFieldDeclaration" value="true"/>
</module>
<module name="MissingSwitchDefault"/>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>
<module name="FinalClass"/>
<module name="InterfaceIsType"/>
<module name="VisibilityModifier">
<property name="packageAllowed" value="true"/>
<property name="protectedAllowed" value="true"/>
</module>
<module name="StringLiteralEquality"/>
<module name="NestedForDepth">
<property name="max" value="3"/>
</module>
<module name="NestedIfDepth">
<property name="max" value="4"/>
</module>
<module name="UncommentedMain">
<property name="excludedClasses" value=".*Application$"/>
</module>
<module name="Regexp">
<property name="format" value="System\.out\.println"/>
<property name="illegalPattern" value="true"/>
</module>
<module name="ReturnCount">
<property name="max" value="4"/>
</module>
<module name="NestedTryDepth ">
<property name="max" value="4"/>
</module>
<module name="SuperFinalize"/>
<module name="SuperClone"/>
</module>
</module>

@ -0,0 +1,28 @@
<?xml version="1.0"?>
<!--
~ 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 suppressions PUBLIC
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
<suppressions>
<suppress checks="MagicNumber" files="ResizableCapacityLinkedBlockingQueue.java"/>
<suppress checks="InnerAssignment" files="ResizableCapacityLinkedBlockingQueue.java"/>
<suppress checks="StaticVariableName" files="ApplicationContextHolder.java"/>
<suppress checks="StaticVariableName" files="JacksonHandler.java"/>
<suppress checks="MagicNumber" files="ByteConvertUtil.java"/>
</suppressions>

@ -7,6 +7,7 @@
<version>${revision}</version> <version>${revision}</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>${project.artifactId}</name> <name>${project.artifactId}</name>
<url>https://github.com/opengoofy/hippo4j</url>
<description>Dynamic observable thread pool framework</description> <description>Dynamic observable thread pool framework</description>
<modules> <modules>
@ -60,6 +61,7 @@
<java.version>1.8</java.version> <java.version>1.8</java.version>
<skip.maven.gpg.plugin>true</skip.maven.gpg.plugin> <skip.maven.gpg.plugin>true</skip.maven.gpg.plugin>
<skip.spotless.apply>false</skip.spotless.apply> <skip.spotless.apply>false</skip.spotless.apply>
<skip.checkstyle.check>true</skip.checkstyle.check>
<maven.javadoc.failOnError>false</maven.javadoc.failOnError> <maven.javadoc.failOnError>false</maven.javadoc.failOnError>
<maven.compiler.encoding>UTF-8</maven.compiler.encoding> <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@ -70,6 +72,7 @@
<maven.jar.plugin.version>3.0.2</maven.jar.plugin.version> <maven.jar.plugin.version>3.0.2</maven.jar.plugin.version>
<license-maven-plugin.version>3.0</license-maven-plugin.version> <license-maven-plugin.version>3.0</license-maven-plugin.version>
<spotless-maven-plugin.version>2.22.1</spotless-maven-plugin.version> <spotless-maven-plugin.version>2.22.1</spotless-maven-plugin.version>
<maven-checkstyle-plugin.version>3.1.0</maven-checkstyle-plugin.version>
</properties> </properties>
<dependencyManagement> <dependencyManagement>
@ -81,104 +84,87 @@
<type>pom</type> <type>pom</type>
<scope>import</scope> <scope>import</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.squareup.okhttp3</groupId> <groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId> <artifactId>okhttp</artifactId>
<version>${okhttp3.version}</version> <version>${okhttp3.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>cn.hutool</groupId> <groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId> <artifactId>hutool-all</artifactId>
<version>${hutool-all.version}</version> <version>${hutool-all.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId> <artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version> <version>${commons-lang3.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>cn.hippo4j</groupId> <groupId>cn.hippo4j</groupId>
<artifactId>hippo4j-message</artifactId> <artifactId>hippo4j-message</artifactId>
<version>${revision}</version> <version>${revision}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>cn.hippo4j</groupId> <groupId>cn.hippo4j</groupId>
<artifactId>hippo4j-core</artifactId> <artifactId>hippo4j-core</artifactId>
<version>${revision}</version> <version>${revision}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>cn.hippo4j</groupId> <groupId>cn.hippo4j</groupId>
<artifactId>hippo4j-adapter-base</artifactId> <artifactId>hippo4j-adapter-base</artifactId>
<version>${revision}</version> <version>${revision}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.baomidou</groupId> <groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId> <artifactId>mybatis-plus-boot-starter</artifactId>
<version>${mybatis-plus.version}</version> <version>${mybatis-plus.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.github.dozermapper</groupId> <groupId>com.github.dozermapper</groupId>
<artifactId>dozer-core</artifactId> <artifactId>dozer-core</artifactId>
<version>${dozer.version}</version> <version>${dozer.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.google.guava</groupId> <groupId>com.google.guava</groupId>
<artifactId>guava</artifactId> <artifactId>guava</artifactId>
<version>${guava.version}</version> <version>${guava.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.aliyun</groupId> <groupId>com.aliyun</groupId>
<artifactId>alibaba-dingtalk-service-sdk</artifactId> <artifactId>alibaba-dingtalk-service-sdk</artifactId>
<version>${dingtalk-sdk.version}</version> <version>${dingtalk-sdk.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.alibaba</groupId> <groupId>com.alibaba</groupId>
<artifactId>transmittable-thread-local</artifactId> <artifactId>transmittable-thread-local</artifactId>
<version>${transmittable-thread-local.version}</version> <version>${transmittable-thread-local.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.hibernate.validator</groupId> <groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId> <artifactId>hibernate-validator</artifactId>
<version>${hibernate-validator.version}</version> <version>${hibernate-validator.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId> <artifactId>slf4j-api</artifactId>
<version>${slf4j-api.version}</version> <version>${slf4j-api.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>ch.qos.logback</groupId> <groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId> <artifactId>logback-core</artifactId>
<version>${logback.version}</version> <version>${logback.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>ch.qos.logback</groupId> <groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId> <artifactId>logback-classic</artifactId>
<version>${logback.version}</version> <version>${logback.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-json</artifactId> <artifactId>spring-boot-starter-json</artifactId>
<version>${spring-boot.version}</version> <version>${spring-boot.version}</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.netty</groupId> <groupId>io.netty</groupId>
<artifactId>netty-all</artifactId> <artifactId>netty-all</artifactId>
@ -297,21 +283,6 @@
<file>${maven.multiModuleProjectDirectory}/dev-support/license-header</file> <file>${maven.multiModuleProjectDirectory}/dev-support/license-header</file>
</licenseHeader> </licenseHeader>
</java> </java>
<pom>
<sortPom>
<encoding>UTF-8</encoding>
<nrOfIndentSpace>4</nrOfIndentSpace>
<keepBlankLines>true</keepBlankLines>
<indentBlankLines>false</indentBlankLines>
<indentSchemaLocation>true</indentSchemaLocation>
<spaceBeforeCloseEmptyElement>true</spaceBeforeCloseEmptyElement>
<sortModules>false</sortModules>
<sortExecutions>false</sortExecutions>
<predefinedSortOrder>custom_1</predefinedSortOrder>
<expandEmptyElements>false</expandEmptyElements>
<sortProperties>false</sortProperties>
</sortPom>
</pom>
</configuration> </configuration>
<executions> <executions>
<execution> <execution>
@ -322,11 +293,33 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${maven-checkstyle-plugin.version}</version>
<configuration>
<configLocation>${maven.multiModuleProjectDirectory}/dev-support/hippo4j_checkstyle.xml</configLocation>
<suppressionsLocation>${maven.multiModuleProjectDirectory}/dev-support/hippo4j_checkstyle_suppression.xml</suppressionsLocation>
<!-- Do not scan the test directory for now -->
<includeTestSourceDirectory>false</includeTestSourceDirectory>
<consoleOutput>true</consoleOutput>
<encoding>UTF-8</encoding>
<skip>${skip.checkstyle.check}</skip>
<violationSeverity>error</violationSeverity>
</configuration>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<goals>
<goal>checkstyle</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins> </plugins>
</build> </build>
<url>https://github.com/opengoofy/hippo4j</url>
<licenses> <licenses>
<license> <license>
<name>The Apache Software License, Version 2.0</name> <name>The Apache Software License, Version 2.0</name>

Loading…
Cancel
Save