walkmod / walkmod-pmd-plugin

Walkmod plugin to fix the code according the PMD rules
2 stars 2 forks source link

How to use this in gradle project? #26

Open arunkumarg26 opened 6 years ago

rpau commented 6 years ago
        It is explained in walkmod.com---- On vie, 05 ene 2018 06:09:10 +0100  Arunkumar Ganapathy<notifications@github.com> wrote ----  —You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or mute the thread.             
arunkumarg26 commented 6 years ago

This is my

walkmod.xml

<!DOCTYPE walkmod PUBLIC "-//WALKMOD//DTD" "http://www.walkmod.com/dtd/walkmod-1.1.dtd">
<walkmod>
    <chain name="default">
        <transformation type="dead-code-cleaner"/>
        <transformation type="sonar:AddCurlyBrackets"/>
        <transformation type="sonar:AddSwitchDefaultCase"/>
        <transformation type="sonar:ArrayDesignatorOnType"/>
        <transformation type="sonar:CollapsibleIfStatements"/>
        <transformation type="sonar:DeclarationsShouldUseCollectionInterfaces"/>
        <transformation type="sonar:PrimitiveInstantiationForToString"/>
        <transformation type="sonar:RedundantCastsShouldNotBeUsed"/>
        <transformation type="sonar:RemoveCodeComment"/>
        <transformation type="sonar:RemoveEmptyMethod"/>
        <transformation type="sonar:RemoveEmptyStatement"/>
        <transformation type="sonar:RemoveLiteralBoolean"/>
        <transformation type="sonar:RemoveUnusedMethodParameters"/>
        <transformation type="sonar:RemoveUselessImports"/>
        <transformation type="sonar:RemoveUselessParentheses"/>
        <transformation type="sonar:RemoveUselessVariables"/>
        <transformation type="sonar:StaticInitializedFieldToFinal"/>
        <transformation type="sonar:StringCheckOnLeft"/>
        <transformation type="sonar:UseCollectionIsEmpty"/>
        <transformation type="sonar:UseStringEquals"/>
        <transformation type="sonar:VariableImmediatelyReturned"/>
        <transformation type="pmd:VariableImmediatelyReturned"/>
    </chain>
</walkmod>

build.gradle

buildscript {

    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.walkmod:gradle-walkmod-plugin:0.0.1")

    }
}

group 'com.example'
version '1.0-SNAPSHOT'

apply plugin: 'java'
apply plugin: 'walkmod'

sourceCompatibility = 1.8

repositories {
    mavenCentral()
    jcenter()
}

dependencies {
    compile 'org.walkmod:walkmod-sonar-plugin:1.2.2'
    testCompile group: 'junit', name: 'junit', version: '4.12'
}

I'm getting an error saying "Chain Failed". Am I missing something here? Please help

arunkumarg26 commented 6 years ago

Can you point me to some working examples?