Jenkins & JSHint – Integrating with Checkstyles and Violations
Oct 5, 2012
1 minute read

Prerequisite

You need to have some form of jshint installed on your server. Instructions of how to do that are out of scope for this post, and should be able to be easily found on the internet. I used the version that installed with npm.

Jenkins Build Tasks

This is a very simple setup that uses 2 Build > Execute Shell tasks. In the first shell task I created the checkstyle output:

jshint --checkstyle-reporter app/webroot/javascripts/mdc/ > build/logs/checkstyle-jshint.xml || exit 0

In the second, I created the jslint output:

jshint --jslint-reporter app/webroot/javascripts/mdc/ > build/logs/jslint.xml || exit 0

Build Task Settings

Checkstyle Plugin

Configure the checkstyles plugin to reference the created checkstyle-jshint.xml file:

Checkstyle Settings

Violations Plugin

Configure the violations plugin to reference the created checkstyle-jshint.xml and the jslint.xml file:

Violations Setup