pmayweg / sonar-groovy

SonarQube plugin for Groovy
GNU Lesser General Public License v3.0
52 stars 65 forks source link

Set sonar.groovy.codenarc.reportPath for multiple files #54

Closed mxt33 closed 7 years ago

mxt33 commented 8 years ago

Hello

I have a Grails project configured with (build.gradle):

tasks.withType(CodeNarc) {
    it.reports {
        xml.enabled = true
        html.enabled = true
    }
    it.ignoreFailures = true
    it.configFile = file('config/codenarc/codenarc.groovy')
}

This generates 3 XML files (~\myproject\build\reports\codenarc): main.xml, test.xml and integrationTest.xml

According to: sonar-groovy

"It is possible to reuse a previously generated report from CodeNarc by setting the sonar.groovy.codenarc.reportPath property."

I cannot seem to set sonar.groovy.codenarc.reportPath to multiple XML files. Any ideas?

Thanks

Mark

bellingard commented 8 years ago

Indeed, the sonar.groovy.codenarc.reportPath accepts only 1 file.

If I understand correctly your context @markandirene , the 3 files that are generated target 3 different parts of your code: the main source code, the unit test code, and the integration test code. In SonarQube, apart from some special cases, we generally attach issues only to main source code. So I'd say that you just have to point to the main.xml file and ignore the other ones - unfortunately, waiting that someone implements this feature.

musketyr commented 7 years ago

this should be relatively easy as parseReport already accepts multiple files

https://github.com/pmayweg/sonar-groovy/blob/34d64a46e185ea353c47722c06a392fc9680c421/sonar-groovy-plugin/src/main/java/org/sonar/plugins/groovy/codenarc/CodeNarcSensor.java#L74-L86

pmayweg commented 7 years ago

Could you change your pull request to include a new property sonar.groovy.codenarc.reportPaths for multiple paths? That is the style used with other sonar plugins.

musketyr commented 6 years ago

@pmayweg would you mind to release a final version of this so it can be found by Sonar updates?