Initial /build-resources/ with jetty-checkstyle.xml

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
Joakim Erdfelt 2019-05-08 10:57:15 -05:00
parent bfcf8f8b2a
commit 8246011020
3 changed files with 357 additions and 0 deletions

22
build-resources/pom.xml Normal file
View File

@ -0,0 +1,22 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.eclipse.jetty</groupId>
<artifactId>build-resources</artifactId>
<version>9.4.19-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Jetty :: Build Resources</name>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<configuration>
<!-- never deploy to a repository, only use in reactor -->
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,264 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<!--
Checkstyle configuration that checks the Jetty coding conventions.
-->
<module name = "Checker">
<property name="charset" value="UTF-8"/>
<property name="severity" value="warning"/>
<property name="fileExtensions" value="java"/>
<!-- Excludes all 'module-info.java' files -->
<!-- See https://checkstyle.org/config_filefilters.html -->
<module name="BeforeExecutionExclusionFileFilter">
<property name="fileNamePattern" value="module\-info\.java$"/>
</module>
<!-- Checks for whitespace -->
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
<module name="FileTabCharacter">
<property name="eachLine" value="true"/>
</module>
<module name="TreeWalker">
<!--
Eclipse Jetty Specific.
===========================================================================================
-->
<!-- Check abbreviations(consecutive capital letters) length in identifier name -->
<module name="AbbreviationAsWordInName">
<property name="ignoreFinal" value="true"/>
<property name="allowedAbbreviationLength" value="1"/>
<property name="allowedAbbreviations" value="RFC,XML,URL,URI,HTTP,IP,ID,ISO8859,UTF8,CRLF,AWT"/>
</module>
<!-- Location of Annotations -->
<module name="AnnotationLocation">
<property name="allowSamelineSingleParameterlessAnnotation" value="false"/>
</module>
<!-- Catch Parameter Name Format -->
<module name="CatchParameterName">
<property name="format" value="^(e|t|x|ex|[a-z][a-z][a-zA-Z0-9]+)$"/>
</module>
<!-- Class Type Parameter Name Format -->
<module name="ClassTypeParameterName">
<property name="format" value="^[A-Z][A-Z0-9]*$"/>
</module>
<!-- Import Line Ordering -->
<module name="CustomImportOrder">
<property name="sortImportsInGroupAlphabetically" value="true"/>
<property name="separateLineBetweenGroups" value="true"/>
<property name="customImportOrderRules" value="STANDARD_JAVA_PACKAGE###THIRD_PARTY_PACKAGE###STATIC"/>
</module>
<!-- do not allow empty blocks in: try, finally, if, else, or switch -->
<module name="EmptyBlock">
<property name="option" value="TEXT"/>
<property name="tokens"
value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/>
</module>
<!-- enforce empty line after specified tokens -->
<module name="EmptyLineSeparator">
<property name="allowNoEmptyLineBetweenFields" value="true"/>
<property name="allowMultipleEmptyLines" value="false"/>
<property name="tokens"
value="PACKAGE_DEF, IMPORT, STATIC_IMPORT, CLASS_DEF, INTERFACE_DEF, ENUM_DEF,
STATIC_INIT, INSTANCE_INIT, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/>
</module>
<!-- Interface Type Parameter Name -->
<module name="InterfaceTypeParameterName">
<property name="format" value="^[A-Z][A-Z0-9]*$"/>
</module>
<!-- left curly brace must be on new line -->
<module name="LeftCurly">
<property name="option" value="nl"/>
</module>
<!-- Method Type Parameter Name -->
<module name="MethodTypeParameterName">
<property name="format" value="^[A-Z][A-Z0-9]*$"/>
</module>
<!-- Member Name Format -->
<module name="MemberName">
<property name="format" value="^[_a-z][a-zA-Z0-9]*$"/>
</module>
<!-- No Whitespace Before specific tokens -->
<module name="NoWhitespaceBefore">
<property name="tokens"
value="COMMA, SEMI, POST_INC, POST_DEC, DOT, ELLIPSIS, METHOD_REF"/>
<property name="allowLineBreaks" value="true"/>
</module>
<!-- allowed wrapping for operators -->
<module name="OperatorWrap">
<property name="option" value="eol"/>
</module>
<!-- ensure we don't have legacy comments that confuse javadoc tooling -->
<module name="Regexp">
<property name="id" value="LegacyMethodSeparators"/>
<property name="format" value="/\*\s*[=*-]*\s*\*/"/>
<property name="illegalPattern" value="true"/>
<property name="ignoreComments" value="false"/>
<property name="message" value="Legacy Method Separators"/>
</module>
<!-- right curly brace must be on new line -->
<module name="RightCurly">
<property name="option" value="alone_or_singleline"/>
</module>
<!-- Various Wrapping of ".", ",", "...", "[]", and method ref New Lines -->
<module name="SeparatorWrap">
<property name="id" value="SeparatorWrapNextLine"/>
<property name="tokens" value="DOT"/>
<property name="option" value="nl"/>
</module>
<module name="SeparatorWrap">
<property name="id" value="SeparatorWrapSameLine"/>
<property name="tokens" value="COMMA,ELLIPSIS,ARRAY_DECLARATOR,METHOD_REF"/>
<property name="option" value="eol"/>
</module>
<!-- checks that a token is followed by whitespace -->
<module name="WhitespaceAround">
<property name="allowEmptyConstructors" value="true"/>
<property name="allowEmptyLambdas" value="true"/>
<property name="allowEmptyMethods" value="true"/>
<property name="allowEmptyTypes" value="true"/>
<property name="allowEmptyLoops" value="true"/>
</module>
<!--
Checks based on common Open Source specific recommendations.
===========================================================================================
-->
<!-- limit use of unicode escape sequences (eg "\u20ac") in mainline code. -->
<module name="AvoidEscapedUnicodeCharacters">
<!-- allow control characters to use unicode escape sequences -->
<property name="allowEscapesForControlCharacters" value="true"/>
<!-- allow unicode escape sequences if also followed by tail comments -->
<property name="allowByTailComment" value="true"/>
<!-- allow use of non-printable escape sequences -->
<property name="allowNonPrintableEscapes" value="true"/>
</module>
<!-- not allowing star import lines -->
<module name="AvoidStarImport"/>
<!-- if you have an empty catch block, name the caught exception "ignored" -->
<module name="EmptyCatchBlock">
<property name="exceptionVariableName" value="ignored"/>
</module>
<!-- if a switch statement contains java code, but lacks fall through comment its an error -->
<module name="FallThrough"/>
<!-- reject unicode or octal values in mainline code -->
<module name="IllegalTokenText">
<property name="tokens" value="STRING_LITERAL, CHAR_LITERAL"/>
<property name="format"
value="\\u00(09|0(a|A)|0(c|C)|0(d|D)|22|27|5(C|c))|\\(0(10|11|12|14|15|42|47)|134)"/>
<property name="message"
value="Consider using special escape sequence instead of octal value or Unicode escaped value."/>
</module>
<!-- all switch statements should have "default" label declared -->
<module name="MissingSwitchDefault"/>
<!-- require braces if using more then 1 line of code -->
<!-- TODO: need better way to allow 1 statement below <module name="NeedBraces">
<property name="allowSingleLineStatement" value="true"/>
</module>-->
<!-- prevent line wrapping of import / package statements -->
<module name="NoLineWrap"/>
<!-- only 1 top level class defined per java file -->
<module name="OneTopLevelClass"/>
<!-- Filename and Classname match -->
<module name="OuterTypeFilename"/>
<!-- Checks that overload methods are grouped together -->
<module name="OverloadMethodsDeclarationOrder"/>
<!--
Checks based on the Java Language Specification recommendations.
https://docs.oracle.com/javase/specs/jls/se8/html/index.html
===========================================================================================
-->
<!-- array type style -->
<!-- int[] foo; // OK
int foo[]; // BAD -->
<module name="ArrayTypeStyle" />
<!-- Whitespace around Generics (angle brackets) follow convention -->
<module name="GenericWhitespace" />
<!-- Lambda Parameter Name Format -->
<module name="LambdaParameterName" />
<!-- Local Parameter Name Format -->
<module name="LocalVariableName" />
<!-- Indentation Rules -->
<module name="Indentation" />
<!-- Method Name Format -->
<module name="MethodName" />
<!-- Checks the padding between the identifier of a method definition, constructor definition,
method call, or constructor invocation: nospace -->
<module name="MethodParamPad"/>
<!-- ensure that modifiers follow suggested order -->
<module name="ModifierOrder"/>
<!-- only 1 variable declaration per line -->
<module name="MultipleVariableDeclarations"/>
<!-- No Object.finalize() use -->
<module name="NoFinalizer"/>
<!-- checks that there is only one statement per line -->
<module name="OneStatementPerLine"/>
<!-- package name JLS rules -->
<module name="PackageName" />
<!-- Parameter Name Format -->
<module name="ParameterName" />
<!-- the policy on the padding of parentheses: nospace -->
<module name="ParenPad"/>
<!-- Type Name format -->
<module name="TypeName" />
<!-- checks that long constants are defined with an upper ell. That is 'L' and not 'l' -->
<module name="UpperEll"/>
<!-- TODO: look for float / double version of above -->
<!-- Checks the distance between declaration of variable and its first usage -->
<module name="VariableDeclarationUsageDistance"/>
</module>
</module>

71
pom.xml
View File

@ -80,6 +80,7 @@
</scm>
<modules>
<module>build-resources</module>
<module>jetty-ant</module>
<module>jetty-util</module>
<module>jetty-jmx</module>
@ -1094,6 +1095,76 @@
</pluginManagement>
</build>
</profile>
<profile>
<id>checkstyle</id>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>3.0.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<reportSets>
<reportSet>
<reports>
<report>checkstyle</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<configLocation>jetty-checkstyle.xml</configLocation>
</configuration>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>build-resources</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>8.20</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
<executions>
<execution>
<id>build-site</id>
<goals>
<goal>site</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>jdk8</id>
<activation>