From 145d53a768f587f9775465653b9f9f73e8e3af18 Mon Sep 17 00:00:00 2001 From: Niklas Baudy Date: Thu, 23 Jun 2016 23:49:44 +0200 Subject: [PATCH] 2.x: Add PMD --- build.gradle | 38 +++++++++ pmd.xml | 230 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 268 insertions(+) create mode 100644 pmd.xml diff --git a/build.gradle b/build.gradle index 8266454512..86d47ffb6a 100644 --- a/build.gradle +++ b/build.gradle @@ -8,6 +8,7 @@ group = 'io.reactivex.rxjava2' description = 'RxJava: Reactive Extensions for the JVM – a library for composing asynchronous and event-based programs using observable sequences for the Java VM.' apply plugin: 'java' +apply plugin: 'pmd' apply plugin: 'jacoco' apply plugin: 'nebula.rxjava-project' @@ -54,3 +55,40 @@ jacocoTestReport { } build.dependsOn jacocoTestReport + +pmd { + toolVersion = '5.4.2' + ignoreFailures = true + sourceSets = [sourceSets.main] + ruleSets = [] + ruleSetFiles = files('pmd.xml') + +} + +pmdMain { + reports { + html.enabled = true + xml.enabled = true + } +} + +build.dependsOn pmdMain + +task pmdPrint(dependsOn: 'pmdMain') << { + File file = new File('build/reports/pmd/main.xml') + if (file.exists()) { + + println("Listing first 100 PMD violations") + + file.eachLine { line, count -> + if (count <= 100) { + println(line) + } + } + + } else { + println("PMD file not found.") + } +} + +build.dependsOn pmdPrint \ No newline at end of file diff --git a/pmd.xml b/pmd.xml new file mode 100644 index 0000000000..e6fbccdd95 --- /dev/null +++ b/pmd.xml @@ -0,0 +1,230 @@ + + + RxJava PMD ruleset + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file