Skip to content

Commit

Permalink
Analyze project with error prone
Browse files Browse the repository at this point in the history
  • Loading branch information
pzygielo committed Apr 27, 2024
1 parent 267fc19 commit bace092
Show file tree
Hide file tree
Showing 4 changed files with 269 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/analyses.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#
# Copyright (c) 2024 Contributors to the Eclipse Foundation
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0,
# or the Eclipse Distribution License v. 1.0 which is available at
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
#

name: Eclipse OpenMQ CI Checks

on:
pull_request:

jobs:
checks:
name: Checks on JDK ${{ matrix.java_version }} (${{ matrix.tool }})
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
java_version: [ 21 ]
tool:
- javac+error-prone

steps:
- name: Checkout for build
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ matrix.java_version }}
- name: Prepare for error-prone
if: ${{ matrix.tool == 'javac+error-prone' }}
run: cp -v .mvn/jvm.config.error-prone .mvn/jvm.config
- name: Test Maven Build
run: |
./mvnw \
--show-version \
--no-transfer-progress \
--activate-profiles staging \
--activate-profiles ${{ matrix.tool }} \
--file mq/main \
verify \
--projects -packager-opensource \
--define skipTests=true
2 changes: 2 additions & 0 deletions .mvn/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
jvm.config

10 changes: 10 additions & 0 deletions .mvn/jvm.config.error-prone
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
--add-opens jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
--add-opens jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED
205 changes: 205 additions & 0 deletions mq/main/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
<spotbugs.plugin.version>4.8.4.0</spotbugs.plugin.version>
<checkstyle.version>10.15.0</checkstyle.version>
<maven.checkstyle.plugin.version>3.3.1</maven.checkstyle.plugin.version>
<error-prone.version>2.27.0</error-prone.version>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -374,6 +375,12 @@
<artifactId>fscontext</artifactId>
<version>4.6-b01</version>
</dependency>

<dependency>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_core</artifactId>
<version>${error-prone.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down Expand Up @@ -938,6 +945,204 @@
</plugins>
</build>
</profile>
<profile>
<id>javac+error-prone</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<fork>false</fork>
<showWarnings>true</showWarnings>
<failOnWarning>true</failOnWarning>
<compilerArgs>
<arg>-XDcompilePolicy=simple</arg>
<arg>
-Xplugin:ErrorProne \
-XepAllDisabledChecksAsWarnings \
-Xep:AddressSelection:OFF \
-Xep:AlmostJavadoc:OFF \
-Xep:AlreadyChecked:OFF \
-Xep:AndroidJdkLibsChecker:OFF \
-Xep:AssertFalse:OFF \
-Xep:AvoidObjectArrays:OFF \
-Xep:BanClassLoader:OFF \
-Xep:BanJNDI:OFF \
-Xep:BanSerializableRead:OFF \
-Xep:BooleanParameter:OFF \
-Xep:BoxedPrimitiveEquality:OFF \
-Xep:ByteBufferBackingArray:OFF \
-Xep:CanIgnoreReturnValueSuggester:OFF \
-Xep:CatchAndPrintStackTrace:OFF \
-Xep:CatchingUnchecked:OFF \
-Xep:CheckedExceptionNotThrown:OFF \
-Xep:ClassCanBeStatic:OFF \
-Xep:ComplexBooleanConstant:OFF \
-Xep:ConstantField:OFF \
-Xep:DeduplicateConstants:OFF \
-Xep:DefaultCharset:OFF \
-Xep:DifferentNameButSame:OFF \
-Xep:DoubleCheckedLocking:OFF \
-Xep:EmptyBlockTag:OFF \
-Xep:EmptyCatch:OFF \
-Xep:EqualsBrokenForNull:OFF \
-Xep:EqualsGetClass:OFF \
-Xep:EqualsHashCode:OFF \
-Xep:EqualsUnsafeCast:OFF \
-Xep:EnumOrdinal:OFF \
-Xep:ErroneousBitwiseExpression:OFF \
-Xep:FallThrough:OFF \
-Xep:FieldCanBeFinal:OFF \
-Xep:FieldCanBeLocal:OFF \
-Xep:FieldCanBeStatic:OFF \
-Xep:FieldMissingNullable:OFF \
-Xep:Finally:OFF \
-Xep:ForEachIterable:OFF \
-Xep:FunctionalInterfaceClash:OFF \
-Xep:FutureReturnValueIgnored:OFF \
-Xep:HidingField:OFF \
-Xep:ImmutableEnumChecker:OFF \
-Xep:ImmutableMemberCollection:OFF \
-Xep:InconsistentCapitalization:OFF \
-Xep:InconsistentOverloads:OFF \
-Xep:InitializeInline:OFF \
-Xep:InlineTrivialConstant:OFF \
-Xep:InsecureCryptoUsage:OFF \
-Xep:InterfaceWithOnlyStatics:OFF \
-Xep:InterruptedExceptionSwallowed:OFF \
-Xep:Interruption:OFF \
-Xep:IntLongMath:OFF \
-Xep:InvalidBlockTag:OFF \
-Xep:InvalidInlineTag:OFF \
-Xep:Java7ApiChecker:OFF \
-Xep:Java8ApiChecker:OFF \
-Xep:JavaLangClash:OFF \
-Xep:JavaUtilDate:OFF \
-Xep:JdkObsolete:OFF \
-Xep:LockNotBeforeTry:OFF \
-Xep:LockOnNonEnclosingClassLiteral:OFF \
-Xep:LongLiteralLowerCaseSuffix:OFF \
-Xep:MemberName:OFF \
-Xep:MethodCanBeStatic:OFF \
-Xep:MissingCasesInEnumSwitch:OFF \
-Xep:MissingDefault:OFF \
-Xep:MissingSummary:OFF \
-Xep:MixedArrayDimensions:OFF \
-Xep:MultiVariableDeclaration:OFF \
-Xep:MutablePublicArray:OFF \
-Xep:NamedLikeContextualKeyword:OFF \
-Xep:NarrowCalculation:OFF \
-Xep:NarrowingCompoundAssignment:OFF \
-Xep:NonApiType:OFF \
-Xep:NonFinalStaticField:OFF \
-Xep:NonOverridingEquals:OFF \
-Xep:NotJavadoc:OFF \
-Xep:OperatorPrecedence:OFF \
-Xep:OrphanedFormatString:OFF \
-Xep:OverrideThrowableToString:OFF \
-Xep:ParameterComment:OFF \
-Xep:ParameterMissingNullable:OFF \
-Xep:PreferredInterfaceType:OFF \
-Xep:PreferJavaTimeOverload:OFF \
-Xep:PrimitiveArrayPassedToVarargsMethod:OFF \
-Xep:PrivateConstructorForUtilityClass:OFF \
-Xep:RedundantOverride:OFF \
-Xep:RedundantThrows:OFF \
-Xep:ReferenceEquality:OFF \
-Xep:ReturnAtTheEndOfVoidFunction:OFF \
-Xep:ReturnMissingNullable:OFF \
-Xep:ReturnsNullCollection:OFF \
-Xep:ReturnValueIgnored:OFF \
-Xep:ShortCircuitBoolean:OFF \
-Xep:StaticAssignmentInConstructor:OFF \
-Xep:StaticAssignmentOfThrowable:OFF \
-Xep:StaticGuardedByInstance:OFF \
-Xep:StaticQualifiedUsingExpression:OFF \
-Xep:StringCaseLocaleUsage:OFF \
-Xep:StringCharset:OFF \
-Xep:StringSplitter:OFF \
-Xep:SuperEqualsIsObjectEquals:OFF \
-Xep:SuppressWarningsWithoutExplanation:OFF \
-Xep:SwitchDefault:OFF \
-Xep:SynchronizeOnNonFinalField:OFF \
-Xep:SystemConsoleNull:OFF \
-Xep:SystemExitOutsideMain:OFF \
-Xep:SystemOut:OFF \
-Xep:ThreadLocalUsage:OFF \
-Xep:ThreadPriorityCheck:OFF \
-Xep:ThrowSpecificExceptions:OFF \
-Xep:ThrowsUncheckedException:OFF \
-Xep:TooManyParameters:OFF \
-Xep:TransientMisuse:OFF \
-Xep:TypeNameShadowing:OFF \
-Xep:TypeParameterNaming:OFF \
-Xep:UnescapedEntity:OFF \
-Xep:UngroupedOverloads:OFF \
-Xep:UnnecessarilyFullyQualified:OFF \
-Xep:UnnecessaryBoxedAssignment:OFF \
-Xep:UnnecessaryBoxedVariable:OFF \
-Xep:UnnecessaryDefaultInEnumSwitch:OFF \
-Xep:UnnecessaryFinal:OFF \
-Xep:UnnecessaryLongToIntConversion:OFF \
-Xep:UnnecessaryParentheses:OFF \
-Xep:UnnecessaryStringBuilder:OFF \
-Xep:UnsafeLocaleUsage:OFF \
-Xep:UnsafeReflectiveConstructionCast:OFF \
-Xep:UnsynchronizedOverridesSynchronized:OFF \
-Xep:UnusedException:OFF \
-Xep:UnusedVariable:OFF \
-Xep:UseCorrectAssertInTests:OFF \
-Xep:UseEnumSwitch:OFF \
-Xep:Varifier:OFF \
-Xep:Var:OFF \
-Xep:WaitNotInLoop:OFF \
-Xep:WildcardImport:OFF \
-Xep:YodaCondition:OFF \
</arg>
</compilerArgs>
<annotationProcessorPaths>
<path>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_core</artifactId>
<version>${error-prone.version}</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>enforce-files-exist</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireFilesExist>
<files>
<file>${maven.multiModuleProjectDirectory}/.mvn/jvm.config</file>
</files>
<message>
Setup for error-prone needs jvm.config with proper exports/opens.
Existing jvm.config.error-prone can be copied to jvm.config.
</message>
</requireFilesExist>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>add-test-dependencies:junit-jupiter-api</id>
<activation>
Expand Down

0 comments on commit bace092

Please sign in to comment.