Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use multiple CheckStyle executions #945

Merged
merged 4 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions .github/workflows/quality-monitor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,81 @@ jobs:
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
pr-number: ${{ steps.pr.outputs.number }}
config: |
{
"tests": {
"tools": [
{
"id": "test",
"name": "Tests",
"pattern": "**/target/*-reports/TEST*.xml"
}
],
"name": "Tests"
},
"analysis": [
{
"name": "Style",
"id": "style",
"tools": [
{
"id": "checkstyle",
"name": "CheckStyle",
"pattern": "**/target/**checkstyle-result.xml"
},
{
"id": "pmd",
"name": "PMD",
"pattern": "**/target/**pmd.xml"
}
]
},
{
"name": "Bugs",
"id": "bugs",
"icon": "bug",
"tools": [
{
"id": "spotbugs",
"name": "SpotBugs",
"sourcePath": "src/main/java",
"pattern": "**/target/spotbugsXml.xml"
}
]
}
],
"coverage": [
{
"name": "Code Coverage",
"tools": [
{
"id": "jacoco",
"name": "Line Coverage",
"metric": "line",
"sourcePath": "src/main/java",
"pattern": "**/target/site/jacoco/jacoco.xml"
},
{
"id": "jacoco",
"name": "Branch Coverage",
"metric": "branch",
"sourcePath": "src/main/java",
"pattern": "**/target/site/jacoco/jacoco.xml"
}
]
},
{
"name": "Mutation Coverage",
"tools": [
{
"id": "pit",
"name": "Mutation Coverage",
"metric": "mutation",
"sourcePath": "src/main/java",
"pattern": "**/target/pit-reports/mutations.xml"
}
]
}
]
}

4 changes: 2 additions & 2 deletions doc/Continuous-Integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ definiert, d.h. eine Aktualisierung lässt sich im entsprechenden Abschnitt leic
über den [Dependabot](https://dependabot.com) Roboter von GitHub automatisch über einen Pull Request aktualisiert.
U.a. sind die folgenden Plugins vorkonfiguriert:
- maven-compiler-plugin: konfiguriert die Java Version auf Java 8 und legt alle Error Prone Regeln fest. Die Java
Version kann beliebig aktualisert werden.
Version kann beliebig aktualisiert werden.
- maven-javadoc-plugin: aktiviert die strikte Prüfung von JavaDoc Kommentaren
- maven-jar-plugin: legt einen Modulnamen fest, falls das Projekt in Java 9 oder höher verwendet wird. Außerdem wird
ein test-jar konfiguriert, sodass alle Tests (und abstrakte Testklassen) auch als Dependencies genutzt werden können.
- maven-pmd-plugin: prüft das Projekt mit PMD, die Regeln liegen in der Datei [pmd-configuration.xml](../etc/pmd-configuration.xml).
- maven-checkstyle-plugin: prüft das Projekt mit CheckStyle, die Regeln liegen in der Datei [checkstyle-configuration.xml](../etc/checkstyle-configuration.xml).
- maven-checkstyle-plugin: prüft das Projekt mit CheckStyle, die Regeln liegen in den Dateien [checkstyle-java-configuration.xml](../etc/checkstyle-java-configuration.xml) und [checkstyle-tests-configuration.xml](../etc/checkstyle-tests-configuration.xml).
- spotbugs-maven-plugin: prüft das Projekt mit SpotBugs, alle Regeln werden verwendet mit den Ausnahmen definiert in der Datei [spotbugs-exclusion-filter.xml](../etc/spotbugs-exclusion-filter.xml).
- org.revapi: prüft, ob die aktuelle Versionsnummer die [semantische Versionierung](https://semver.org) berücksichtigt (source and binary). D.h. es gilt:
1. Eine neue **Major** Version wurde definiert, wenn das API nicht mehr abwärtskompatibel ist.
Expand Down
File renamed without changes.
182 changes: 182 additions & 0 deletions etc/checkstyle-tests-configuration.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Checkstyle-Configuration: Ullrich Hafner
Description: Ullrich Hafner's Checkstyle Rules.
-->
<!-- ${project.groupId}:${project.artifactId}:${project.version} -->
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
<module name="Checker">
<property name="severity" value="warning"/>
<module name="RegexpMultiline">
<property name="format" value="\{\s*\R\s*\R"/>
<property name="message" value="No empty lines after opening curly braces allowed" />
</module>
<module name="RegexpMultiline">
<property name="format" value="\R\s*\R\s*\}"/>
<property name="message" value="No empty lines before closing curly braces allowed" />
</module>
<module name="TreeWalker">
<module name="SuppressWarningsHolder" />

<module name="NoWhitespaceBeforeCaseDefaultColon"/>
<module name="UnnecessarySemicolonAfterOuterTypeDeclaration"/>
<module name="UnnecessarySemicolonInTryWithResources"/>
<module name="UnnecessarySemicolonInEnumeration"/>
<module name="AvoidDoubleBraceInitialization"/>
<module name="NoEnumTrailingComma"/>
<module name="OneStatementPerLine"/>
<module name="OuterTypeFilename"/>
<module name="NestedForDepth">
<property name="max" value="2"/>
</module>
<module name="InnerTypeLast"/>

<module name="AnnotationUseStyle"/>
<module name="Indentation">
<property name="arrayInitIndent" value="8"/>
<property name="lineWrappingIndentation" value="8"/>
</module>
<module name="MissingDeprecated"/>
<module name="PackageAnnotation"/>
<module name="EqualsAvoidNull"/>
<module name="GenericWhitespace"/>
<module name="JavadocStyle">
<property name="severity" value="warning"/>
<property name="checkEmptyJavadoc" value="true"/>
</module>
<module name="JavadocType"/>
<module name="JavadocMethod"/>
<module name="JavadocParagraph"/>
<module name="JavadocVariable">
<property name="scope" value="protected"/>
<property name="tokens" value="VARIABLE_DEF"/>
</module>
<module name="MissingJavadocMethodCheck">
<property name="allowMissingPropertyJavadoc" value="true"/>
<property name="ignoreMethodNamesRegex" value="size|isEmpty|isNotEmpty"/>
</module>
<module name="MissingJavadocTypeCheck"/>
<module name="MissingJavadocPackageCheck"/>
<module name="JavadocMissingLeadingAsteriskCheck"/>
<module name="JavadocMissingWhitespaceAfterAsteriskCheck"/>
<module name="JavadocContentLocationCheck"/>
<module name="JavadocBlockTagLocation"/>
<module name="InvalidJavadocPosition"/>
<module name="ConstantName"/>
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName"/>
<module name="MemberName"/>
<module name="MethodName"/>
<module name="PackageName"/>
<module name="ParameterName"/>
<module name="StaticVariableName"/>
<module name="LambdaParameterName"/>
<module name="TypeName"/>
<module name="ClassTypeParameterName"/>
<module name="MethodTypeParameterName"/>
<module name="AnonInnerLength">
<property name="max" value="10"/>
</module>
<module name="LambdaBodyLength">
<property name="max" value="10"/>
</module>
<module name="MethodLength"/>
<module name="ParameterNumber"/>
<module name="EmptyForIteratorPad"/>
<module name="EmptyLineSeparator">
<property name="allowMultipleEmptyLines" value="false"/>
<property name="allowMultipleEmptyLinesInsideClassMembers" value="false"/>
<property name="allowNoEmptyLineBetweenFields" value="true"/>
</module>

<module name="NoWhitespaceAfter">
<property name="tokens" value="ARRAY_INIT,BNOT,DEC,DOT,INC,LNOT,UNARY_MINUS,UNARY_PLUS"/>
</module>
<module name="NoWhitespaceBefore"/>
<module name="OperatorWrap"/>
<module name="TypecastParenPad">
<property name="tokens" value="RPAREN,TYPECAST"/>
</module>
<module name="WhitespaceAfter">
<property name="tokens" value="COMMA,SEMI"/>
</module>
<module name="WhitespaceAround">
<property name="tokens"
value="ASSIGN,BAND,BAND_ASSIGN,BOR,BOR_ASSIGN,BSR,BSR_ASSIGN,BXOR,BXOR_ASSIGN,COLON,DIV,DIV_ASSIGN,EQUAL,GE,GT,LAND,LCURLY,LE,LITERAL_ASSERT,LITERAL_CATCH,LITERAL_DO,LITERAL_ELSE,LITERAL_FINALLY,LITERAL_FOR,LITERAL_IF,LITERAL_RETURN,LITERAL_SYNCHRONIZED,LITERAL_TRY,LITERAL_WHILE,LOR,LT,MINUS,MINUS_ASSIGN,MOD,MOD_ASSIGN,NOT_EQUAL,PLUS,PLUS_ASSIGN,QUESTION,SL,SLIST,SL_ASSIGN,SR,SR_ASSIGN,STAR,STAR_ASSIGN,LITERAL_ASSERT,TYPE_EXTENSION_AND"/>
</module>
<module name="ParenPad"/>
<module name="MethodParamPad"/>
<module name="ModifierOrder"/>
<module name="RedundantModifier"/>
<module name="AvoidNestedBlocks"/>
<module name="EmptyBlock">
<property name="option" value="text"/>
<property name="tokens" value="LITERAL_CATCH"/>
</module>
<module name="EmptyBlock">
<property name="tokens"
value="LITERAL_DO,LITERAL_ELSE,LITERAL_FINALLY,LITERAL_IF,LITERAL_FOR,LITERAL_TRY,LITERAL_WHILE,STATIC_INIT"/>
</module>
<module name="LeftCurly"/>
<module name="NeedBraces"/>
<module name="RightCurly">
<property name="option" value="alone"/>
</module>
<module name="CovariantEquals"/>
<module name="DefaultComesLast"/>
<module name="EmptyStatement"/>
<module name="EqualsHashCode"/>
<module name="FallThrough"/>
<module name="HiddenField">
<property name="ignoreConstructorParameter" value="true"/>
<property name="ignoreSetter" value="true"/>
<property name="ignoreAbstractMethods" value="true"/>
<property name="setterCanReturnItsClass" value="true"/>
</module>
<module name="IllegalThrows"/>
<module name="InnerAssignment"/>
<module name="ModifiedControlVariable"/>
<module name="MultipleVariableDeclarations"/>
<module name="NestedTryDepth"/>
<module name="NestedIfDepth">
<property name="max" value="2"/>
</module>
<module name="PackageDeclaration"/>
<module name="ParameterAssignment"/>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>
<module name="StringLiteralEquality"/>
<module name="SuperClone"/>
<module name="SuperFinalize"/>
<module name="InterfaceIsType"/>
<module name="MutableException"/>
<module name="ThrowsCount">
<property name="max" value="3"/>
</module>
<module name="VisibilityModifier"/>
<module name="BooleanExpressionComplexity"/>
<module name="ClassDataAbstractionCoupling">
<property name="max" value="10"/>
</module>
<module name="ClassFanOutComplexity">
<property name="max" value="25"/>
</module>
<module name="JavaNCSS"/>
<module name="ArrayTypeStyle"/>
<module name="UpperEll"/>
<module name="IllegalCatch"/>
<module name="IllegalImport">
<property name="illegalPkgs" value="net.jcip.annotations"/>
<property name="illegalClasses" value="edu.umd.cs.findbugs.annotations.Nullable, javax.annotation.Nullable, javax.annotation.CheckForNull, javax.annotation.Nonnull"/>
<property name="severity" value="error"/>
</module>
</module>
<module name="FileTabCharacter">
<property name="fileExtensions" value="jelly, java"/>
</module>
<module name="FileLength">
<property name="fileExtensions" value="jelly, java"/>
</module>
<module name="SuppressWarningsFilter" />
</module>
27 changes: 22 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -587,10 +587,8 @@
<version>${maven-checkstyle-plugin.version}</version>
<configuration>
<linkXRef>false</linkXRef>
<excludes>**/*Assert*.java,**/*_jmh*,**/module-info.java</excludes>
<failOnViolation>false</failOnViolation>
<configLocation>etc/checkstyle-configuration.xml</configLocation>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
<excludeGeneratedSources>true</excludeGeneratedSources>
<failsOnError>false</failsOnError>
</configuration>
<dependencies>
<dependency>
Expand All @@ -601,11 +599,30 @@
</dependencies>
<executions>
<execution>
<id>run-checkstyle</id>
<id>run-checkstyle-java</id>
<goals>
<goal>checkstyle</goal>
</goals>
<phase>verify</phase>
<configuration>
<excludes>**/module-info.java</excludes>
<includeTestSourceDirectory>false</includeTestSourceDirectory>
<configLocation>etc/checkstyle-java-configuration.xml</configLocation>
<outputFile>${project.build.directory}/checkstyle-java/checkstyle-result.xml</outputFile>
</configuration>
</execution>
<execution>
<id>run-checkstyle-tests</id>
<goals>
<goal>checkstyle</goal>
</goals>
<phase>verify</phase>
<configuration>
<excludes>**/*Assert*.java,**/*_jmh*,**/module-info.java</excludes>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
<configLocation>etc/checkstyle-tests-configuration.xml</configLocation>
<outputFile>${project.build.directory}/checkstyle-tests/checkstyle-result.xml</outputFile>
</configuration>
</execution>
</executions>
</plugin>
Expand Down