Robin Bramley has kindly integrated the CodeNarc XML output with the Hudson Integrations plugin and explained to us how to get this working nicely with Grails.
I encountered a few obstacles getting it going on my new Jenkins installation.
Firstly, the latest CodeNarc version, as of writing, is 0.15. As of version 0.14, you must put your configuration into BuildConfig.groovy instead of Config.groovy. By the way, version 0.14 is more recent than versions 0.8, 0.9 etc in case you're wondering.
Secondly, the config syntax has changed. Check the CodeNarc plugin page, but here's an example:
codenarc.reports = {
Jenkins('xml') {
outputFile = 'target/analysis-reports/CodeNarcReport.xml'
title = 'CodeNarc code Report'
}
}
Thirdly, I started by using the directory target/test-reports as recommended in the post, but I found that Jenkins kept deleting the output before the violations report could be constructed, even if CodeNarc was the last build step. So I changed to using the analysis-reports directory (which is perhaps more fitting anyway) and the problem was solved.
Lastly, I get a violations count and then a little graph/chart showing up with the report, but the chart is empty. Haven't figured that one out yet. Let me know if you overcome the same problem.
Add new comment