Skip to content

Commit

Permalink
Add spotbugs, pmd plugins (#550)
Browse files Browse the repository at this point in the history
Add spotbugs, pmd plugins
  • Loading branch information
acoburn authored Oct 17, 2019
1 parent 0b01512 commit 0525119
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 7 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,23 @@ jobs:
- name: "Java 8"
stage: test
jdk: openjdk8
script: travis_retry ./gradlew check install jacocoRootReport --scan
script: travis_retry ./gradlew check install jacocoRootReport -x pmdMain -x spotbugsMain --scan
after_success: ./gradlew coveralls sonarqube

# JDK 11
- name: "Java 11"
stage: test
jdk: openjdk11
dist: xenial
script: travis_retry ./gradlew check install
script: travis_retry ./gradlew check install -x pmdMain -x spotbugsMain

# JDK 11 (modules)
- name: "Java 11 (modules)"
stage: test
jdk: openjdk11
dist: xenial
env: JOB=jpms
script: travis_retry ./gradlew clean check install -Pjpms
script: travis_retry ./gradlew clean check install -x pmdMain -x spotbugsMain -Pjpms

# deploy JDK 8 builds to Sonatype
- name: "Publish to Sonatype"
Expand Down
28 changes: 28 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
id 'com.github.ben-manes.versions' version '0.27.0'
id 'com.github.hierynomus.license' version '0.15.0'
id 'com.github.kt3k.coveralls' version '2.8.4'
id 'com.github.spotbugs' version '2.0.0'
id 'com.gradle.build-scan' version '2.4.2'
id 'net.researchgate.release' version '2.8.1'
id 'org.owasp.dependencycheck' version '5.2.2'
Expand Down Expand Up @@ -134,7 +135,9 @@ allprojects { subproj ->
apply plugin: 'jacoco'
apply plugin: 'java'
apply plugin: 'maven-publish'
apply plugin: 'pmd'
apply plugin: 'signing'
apply plugin: 'com.github.spotbugs'

ext {
vendor = 'Trellis LDP'
Expand All @@ -144,6 +147,8 @@ allprojects { subproj ->

jacocoVersion = '0.8.4'
checkstyleVersion = '8.18'
pmdVersion = '6.18.0'
spotbugsVersion = '3.1.12'
}

jacoco.toolVersion = jacocoVersion
Expand Down Expand Up @@ -276,6 +281,16 @@ subprojects { subproj ->
useJUnitPlatform()
}

pmd {
ignoreFailures = true
consoleOutput = true
incrementalAnalysis = true
toolVersion = pmdVersion
sourceSets = [sourceSets.main]
ruleSets = []
ruleSetConfig = resources.text.fromFile(rootProject.file('buildtools/src/main/resources/pmd/pmd.xml'))
}

checkstyle {
configFile = rootProject.file('buildtools/src/main/resources/checkstyle/checkstyle.xml')
configProperties.checkstyleConfigDir = rootProject.file('buildtools/src/main/resources/checkstyle/')
Expand Down Expand Up @@ -314,6 +329,19 @@ subprojects { subproj ->
archives sourceJar
}

spotbugs {
ignoreFailures = true
toolVersion = spotbugsVersion
sourceSets = [sourceSets.main]
}

tasks.withType(com.github.spotbugs.SpotBugsTask) {
reports {
xml.enabled = false
html.enabled = true
}
}

license {
include "**/*.java"
header rootProject.file('buildtools/src/main/resources/license/HEADER.txt')
Expand Down
19 changes: 19 additions & 0 deletions buildtools/src/main/resources/pmd/pmd.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>

<ruleset name="Trellis PMD Rules"
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">

<description>
Trellis PMD rules
</description>

<rule ref="category/java/security.xml"/>
<rule ref="category/java/multithreading.xml"/>
<rule ref="category/java/performance.xml"/>
<rule ref="category/java/bestpractices.xml"/>
<rule ref="category/java/errorprone.xml">
<exclude name="BeanMembersShouldSerialize"/>
</rule>
</ruleset>
1 change: 0 additions & 1 deletion components/app-triplestore/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ ext {

configurations.all {
exclude group: 'javax.el', module: 'javax.el-api'
exclude group: 'com.google.code.findbugs', module: 'jsr305'
}

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
4 changes: 2 additions & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi

# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
Expand Down

0 comments on commit 0525119

Please sign in to comment.