Skip to content

Instantly share code, notes, and snippets.

@bobuss
Created November 5, 2012 15:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bobuss/4017823 to your computer and use it in GitHub Desktop.
Save bobuss/4017823 to your computer and use it in GitHub Desktop.
Make jshint to work with jenkins

To make the Jenkins violation plugin to display issues details from jshint :

The full path is missing into the "name" attribute of each tag.

The fix can be :

    sed -E 's?<file name="(.*)\?">?<file name="'`pwd`'/\1">?' jshint.xml > jshint-proper.xml

Use/adapt the enclosed Makefile, and in your Jenkins jobs configuration, make the builder to call the "jslint" task.

    make jslint

In the violation plugin configuration, set the JSLINT parameter to point to the new generated file (in my example, it is jshint-proper.xml).

SRC=src
$(JSHINT):
npm install jshint
JS_FILES=$(shell find $(SRC) -type f -name '*.js')
jslint: $(JSHINT)
-$(JSHINT) --jslint-reporter --config config/jshint.json > jshint.xml $(JS_FILES) || :
sed -E 's?<file name="(.*)\?">?<file name="'`pwd`'/\1">?' jshint.xml > jshint-proper.xml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment