I am trying to generate Codenarc reports for my Gradle Groovy project and publish them to Jenkins.
I have successfully configured my Gradle project to generate Codenarc reports using
build.gradle
apply plugin: 'codenarc'
...
dependencies {
codenarc 'org.codenarc:CodeNarc:0.21'
...
}
codenarc {
configFile = file('config/codenarc/codenarc.groovy')
ignoreFailures = true
reportFormat = 'xml'
reportsDir = new File("build/reports/codenarc")
}
configurations /codenarc/codenarc.groovy
// Read and choose rules here: http://codenarc.sourceforge.net/codenarc-rule-index.html
ruleset {
ruleset('rulesets/basic.xml')
}
I also created work on Jenkins with the Violations plugin, but when a violation report is generated, it does not show actual code violations. It just shows statistics and a blank page if I click on a Groovy file with violations.
I have Grails projects with a Codenarc plugin that displays with the full code snippet in the violation report, so I assume something is wrong with my Codenarc setup in Gradle?
Any help or suggestions are welcome!
:
, XML- Codenarc :
<?xml version='1.0'?>
<CodeNarc url='http://www.codenarc.org' version='0.21'>
<Report timestamp='07-10-2014 15:31:18'/>
<Project title=''>
<SourceDirectory>src\groovy</SourceDirectory>
</Project>
<PackageSummary totalFiles='124' filesWithViolations='118' priority1='0' priority2='156'
priority3='143'></PackageSummary>
<Package path='testmodel' totalFiles='124' filesWithViolations='118' priority1='0' priority2='156'
priority3='143'></Package>
<Package path='testmodel/begivenheder' totalFiles='31' filesWithViolations='30' priority1='0' priority2='32'
priority3='17'>
<File name='AbstraktTest.groovy'>
<Violation ruleName='ClassJavadoc' priority='2' lineNumber='5'>
<SourceLine><![CDATA[@CompileStatic]]></SourceLine>
<Message><![CDATA[Class testmodel.begivenheder.AbstraktAendring missing JavaDoc]]></Message>
</Violation>
...
</File>
</Package>
<Rules>
<Rule name='AbcMetric'>
<Description>
<![CDATA[Checks the ABC size metric for methods/classes. A method (or "closure field") with an ABC score greater than the maxMethodAbcScore property (60) causes a violation. Likewise, a class that has an (average method) ABC score greater than the maxClassAverageMethodAbcScore property (60) causes a violation.]]></Description>
</Rule>
...
</Rules>
</CodeNarc>