You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@taverna.apache.org by st...@apache.org on 2016/06/13 12:58:17 UTC
[08/18] incubator-taverna-mobile git commit: add pmd rule sets and
gradle config
add pmd rule sets and gradle config
Project: http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/commit/6128a614
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/tree/6128a614
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/diff/6128a614
Branch: refs/heads/master
Commit: 6128a61493951e3bc48cf2f2ff6fc2eab75a2ed3
Parents: e752e97
Author: Sagar <ku...@gmail.com>
Authored: Fri Jun 10 22:46:28 2016 +0530
Committer: Sagar <ku...@gmail.com>
Committed: Fri Jun 10 22:46:28 2016 +0530
----------------------------------------------------------------------
config/quality/pmd/pmd-ruleset.xml | 40 +++++++++++++++++++++++++++++++++
config/quality/quality.gradle | 24 +++++++++++++++++++-
2 files changed, 63 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/6128a614/config/quality/pmd/pmd-ruleset.xml
----------------------------------------------------------------------
diff --git a/config/quality/pmd/pmd-ruleset.xml b/config/quality/pmd/pmd-ruleset.xml
new file mode 100644
index 0000000..2d66bd6
--- /dev/null
+++ b/config/quality/pmd/pmd-ruleset.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Android Application Rules"
+ xmlns="http://pmd.sf.net/ruleset/1.0.0"
+ xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd"
+ xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd">
+
+ <description>Custom ruleset for ribot Android application</description>
+
+ <exclude-pattern>.*/R.java</exclude-pattern>
+ <exclude-pattern>.*/gen/.*</exclude-pattern>
+
+ <rule ref="rulesets/java/android.xml" />
+ <rule ref="rulesets/java/clone.xml" />
+ <rule ref="rulesets/java/finalizers.xml" />
+ <rule ref="rulesets/java/imports.xml">
+ <!-- Espresso is designed this way !-->
+ <exclude name="TooManyStaticImports" />
+ </rule>
+ <rule ref="rulesets/java/logging-java.xml">
+ <!-- This rule wasn't working properly and given errors in every var call info -->
+ <exclude name="GuardLogStatementJavaUtil" />
+ </rule>
+ <rule ref="rulesets/java/braces.xml">
+ <!-- We allow single line if's without braces -->
+ <exclude name="IfStmtsMustUseBraces" />
+ </rule>
+ <rule ref="rulesets/java/strings.xml" >
+ <!-- Exclude because causes problems with SQL Strings that usually require duplication -->
+ <exclude name="AvoidDuplicateLiterals"/>
+ </rule>
+ <rule ref="rulesets/java/basic.xml" />
+ <rule ref="rulesets/java/naming.xml">
+ <exclude name="AbstractNaming" />
+ <exclude name="LongVariable" />
+ <exclude name="ShortMethodName" />
+ <exclude name="ShortVariable" />
+ <exclude name="ShortClassName" />
+ <exclude name="VariableNamingConventions" />
+ </rule>
+</ruleset>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/6128a614/config/quality/quality.gradle
----------------------------------------------------------------------
diff --git a/config/quality/quality.gradle b/config/quality/quality.gradle
index 8883952..978277f 100644
--- a/config/quality/quality.gradle
+++ b/config/quality/quality.gradle
@@ -1,4 +1,5 @@
apply plugin: 'checkstyle'
+apply plugin: 'pmd'
dependencies {
checkstyle 'com.puppycrawl.tools:checkstyle:6.5'
@@ -7,7 +8,7 @@ dependencies {
def qualityConfigDir = "$project.rootDir/config/quality";
def reportsDir = "$project.buildDir/reports"
-check.dependsOn 'checkstyle'
+check.dependsOn 'checkstyle', 'pmd'
task checkstyle(type: Checkstyle, group: 'Verification', description: 'Runs code style checks') {
configFile file("$qualityConfigDir/checkstyle/checkstyle-config.xml")
@@ -23,4 +24,25 @@ task checkstyle(type: Checkstyle, group: 'Verification', description: 'Runs code
}
classpath = files()
+}
+
+task pmd(type: Pmd, group: 'Verification', description: 'Inspect sourcecode for bugs') {
+ ruleSetFiles = files("$qualityConfigDir/pmd/pmd-ruleset.xml")
+ ignoreFailures = false
+ ruleSets = []
+
+ source 'src'
+ include '**/*.java'
+ exclude '**/gen/**'
+
+ reports {
+ xml.enabled = true
+ html.enabled = true
+ xml {
+ destination "$reportsDir/pmd/pmd.xml"
+ }
+ html {
+ destination "$reportsDir/pmd/pmd.html"
+ }
+ }
}
\ No newline at end of file