Skip to content

Commit

Permalink
Issue checkstyle#41: added eclipse ci
Browse files Browse the repository at this point in the history
  • Loading branch information
rnveach committed Nov 14, 2017
1 parent 9ef13d8 commit 7502650
Show file tree
Hide file tree
Showing 4 changed files with 153 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .ci/eclipse-compiler-javac.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash
set -e

if [ -z "$1" ]; then
echo "No parameters supplied!"
echo " The classpath of the project and it's libraries to compile must be supplied."
exit 1
fi

ECJ_JAR="ecj-4.7.jar"
ECJ_MAVEN_VERSION="R-4.7-201706120950"
ECJ_PATH=~/.m2/repository/$ECJ_MAVEN_VERSION/$ECJ_JAR

if [ ! -f $ECJ_PATH ]; then
echo "$ECJ_PATH is not found, downloading ..."
mkdir -p $(dirname "$ECJ_PATH")
wget http://ftp-stud.fht-esslingen.de/pub/Mirrors/eclipse/eclipse/downloads/drops4/$ECJ_MAVEN_VERSION/$ECJ_JAR -O $ECJ_PATH
fi

mkdir -p target/classes
mkdir -p target/eclipse

RESULT_FILE=target/eclipse/report.txt

echo "Executing eclipse compiler, output is redirected to $RESULT_FILE..."
java -jar $ECJ_PATH -target 1.8 -source 1.8 -cp $1 \
-nowarn:[./target/generated-sources/annotations] -d target/eclipse-compile \
-enableJavadoc src/main/java src/test/java target/generated-sources/annotations -properties config/org.eclipse.jdt.core.prefs \
> $RESULT_FILE 2>&1 | true

echo "Checking for ERROR|WARNING|INFO in $RESULT_FILE ..."
if [[ $(grep -E "ERROR|WARNING|INFO" $RESULT_FILE | cat | wc -l) > 0 ]]; then
cat $RESULT_FILE
false
fi
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ matrix:
- DESC="findbugs and pmd"
- CMD="mvn clean compile pmd:check findbugs:check"

# eclipse static analysis
- jdk: oraclejdk8
env:
- DESC="eclipse static analysis"
- CMD="mvn clean compile exec:exec -Peclipse-compiler"

# checkstyle injection compile no error (oraclejdk8)
- jdk: oraclejdk8
env:
Expand Down
86 changes: 86 additions & 0 deletions config/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=enabled
org.eclipse.jdt.core.compiler.problem.comparingIdentical=error
org.eclipse.jdt.core.compiler.problem.deadCode=error
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=error
org.eclipse.jdt.core.compiler.problem.emptyStatement=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error
org.eclipse.jdt.core.compiler.problem.finalParameterBound=error
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=enabled
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=error
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=error
org.eclipse.jdt.core.compiler.problem.localVariableHiding=error
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=error
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=enabled
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=error
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=error
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=error
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=error
org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=error
org.eclipse.jdt.core.compiler.problem.nullReference=error
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=error
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
org.eclipse.jdt.core.compiler.problem.parameterAssignment=error
org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=error
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=error
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=error
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=error
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=error
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=error
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=error
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=enabled
org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=error
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedImport=error
org.eclipse.jdt.core.compiler.problem.unusedLabel=error
org.eclipse.jdt.core.compiler.problem.unusedLocal=error
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=error
org.eclipse.jdt.core.compiler.problem.unusedParameter=error
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=error
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=error
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
org.eclipse.jdt.core.compiler.problem.fieldHiding=error
#We can not efnforce this rule as we are library and we keep deprecated stuff for some time
org.eclipse.jdt.core.compiler.problem.deprecation=ignore
#We can not use try-with-resources till we use cobertura for coverage
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
#we will not put all String values to resources, it does not make sense in our project
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
#we should print errors on all throwables
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=disabled
#we shouldn't print errors on overriding methods that don't make use of exceptions
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
#We use checkstyle rule, special cases could be suppressed by configs out of code
org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore

#
#All below is disabled till - https://github.com/checkstyle/checkstyle/issues/5060
#
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.annotation.nullanalysis=ignore
26 changes: 26 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -419,5 +419,31 @@
</plugins>
</build>
</profile>
<profile>
<id>eclipse-compiler</id>
<dependencies>
<dependency>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.annotation</artifactId>
<version>2.1.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<configuration>
<executable>.ci/eclipse-compiler-javac.sh</executable>
<classpathScope>test</classpathScope>
<arguments>
<classpath />
</arguments>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

0 comments on commit 7502650

Please sign in to comment.