Download the code from GitHub : Current version 1.0.0
This plugin is now available on the Jenkins update center, so can be installed through the Jenkins plugin manager.
Initially we started out running JSLint on commit, but there are several reasons we switched to running lint in Continuous Integration (CI):
The backbone of our production floor is the Jenkins CI Server – every project has at least one job that runs on commit. Therefore, early on in our journey into automation, we started linting Amaxus 4. All we did was run a shell script that triggered Rhino and output to the regular console log. We then used Jenkins text finder to scan the logs and see whether JSLint had returned a clean bill of health. If not, the build was marked as “Unstable”.
Well, this was working, but only for Amaxus, and here came problem set #2:
We’d made progress, but we didn’t feel it was easy enough to integrate JSLint into a build. So, we looked at options:
We’d made a few plugins for Jenkins – particularly our Amaxus plugin which allows us to set up a customer’s CI process including PHPMd, JSLint, PHPCodeSniffer and PHPUnit in less than a minute. It seemed logical to build a Jenkins plugin that produced logs that we could integrate into the build results. I toyed with the idea of JUnit format output but then plumped for a Checkstyle format – after all, this isn’t a unit test.
Firstly, our modified version of JSLint outputs to Checkstyle format. There were some difficulties with this initially that we had to overcome:
So, here is our plugin’s results page. We’ve found it really useful to have the information right there in the build report!
Head over to https://github.com/boxuk/jslint-jenkins-plugin to get the plugin, and clone away!
You’ll need Apache Maven installed to build it. Just type “mvn” in the project root and it will output an .hpi file in the target directory.
You can then install this plugin by going to the plugin manager in Jenkins and uploading it:
You can then go and set up a job like so:
As mentioned earlier, we made a bunch of modifications to JSLint for our requirements. Since we did that, JSLint has been forked to the less opinionated JSHint so we might switch to that at some point.