WalkMod Open Source Tool to Fix Java Coding Style Issues

Installation

From Binary distribution

The only requirement is the Java Virtual Machine (equal or greater than 1.7).
  1. Download and unzip the to the directory you wish to install walkmod WALKMOD_HOME.
  2. Add WALKMOD_HOME/bin folder to your PATH environment variable.
  3. Open a prompt and type walkmod --version. It should print out your installed version of walkmod, for example:
    Walkmod version "3.0"
    Java version: 1.8.0_101
    Java Home: /Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/jre
    OS: Mac OS X, Version: 10.12.2
Alternatively, Mac OS users can also install walkmod from HomeBrew brew install walkmod

Usage

WalkMod started as a framework to write code transformations. However, most of the users look for quick fixes for existing static code analysis tools. Here appear the commands to get the results.

For PMD

walkmod apply pmd

For CheckStyle

walkmod apply checkstyle

For SonarQube

walkmod apply -DauthToken="THIS_IS_MY_TOKEN" -DsonarHost="https://sonarqube.com" sonar

If you are you interested to selectively apply the required changes incrementally, you need to use WalkModHub. Otherwise, if you want to learn how to use more complex code transformations through a fixed configuration (walkmod.xml), read our documentation.

Integration

Maven

You can run WalkMod in your build process (PMD, CheckStyle or SonarQube) by adding the following in your pom.xml. This example, shows you how to apply quick fixes for PMD using Maven.
          <plugin>
<groupId>org.walkmod.maven.plugins</groupId>
<artifactId>walkmod-maven-plugin</artifactId>
<version>1.0.3</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>apply</goal>
</goals>
<configuration>
<chains>pmd</chains>
<properties>configurationFile=rulesets/java/basic.xml</properties>
</configuration>
</execution>
</executions>
</plugin>
And run
          mvn package

In order set your custom configuration parameters, visit the official plugin site and also learn What is SAP Successfactor?

Gradle

You can also run WalkMod in your gradle project by adding the following in your build.gradle. This example, shows you how to apply quick fixes for PMD using Gradle.
buildscript {
repositories {
mavenCentral()
jcenter()
}

dependencies {
classpath 'org.walkmod:gradle-walkmod-plugin:0.0.1'
}
}
apply plugin: 'walkmod'
walkmod {
chains = [ 'pmd' ]
}
And run
            gradle walkmodApply

In order set your custom configuration parameters, visit the official plugin site

Contribute

You can easily contribute, by starring or forking our .

If you would like to add new quick fix is for an specific static code analysis rule (e.g PMD, CheckStyle, SonarQube), follow the next steps:

  1. Go to our and look for the plugin, where you want to contribute. For example, if you want to contribute to PMD, look for walkmod-pmd-plugin.
  2. For the repository and apply your contributions
  3. Send us a pull request

We also provide professional services to add more quick fixes to our tool.

Work recognition

Do you like this freebie? Want to get more stuff like this?
Subscribe to our newsletter and twitter to stay tuned on automatic quick fix and clean code.

WalkMod