A lack of basic metrics for Groovy in a module containing also Java classes

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

A lack of basic metrics for Groovy in a module containing also Java classes

Marcin Zajączkowski
Hi,

I have Java and Groovy code mixed in one module. Because it is currently
not supported in Sonar I wanted to make a standard (Java) project in
Sonar and the second one with Groovy set as a language to get violations
in Groovy code and maybe a code coverage of Groovy classes.
Unfortunately the result of:
mvn clean package sonar:sonar -Dsonar.language=grvy -Dsonar.branch=groovy
(sonar.branch to not override the first measure)
shows only test result, but no lines of code, classes, comments or
duplication like in
http://nemo.sonarsource.org/dashboard/index/org.codenarc:CodeNarc

In a log I see that Sonar plugin starts with properly set parameters and
use Groovy tools:
[INFO] [15:20:33.450] Quality profile : [name=Sonar way,language=grvy]
(...)
[INFO] [15:20:36.991] Sensor CodeNarc done: 3193 ms
[INFO] [15:20:36.991] Sensor GroovySensor...
[INFO] [15:20:37.225] GMetrics completed: 135ms
[INFO] [15:20:37.225] Sensor GroovySensor done: 234 ms
(...)
[INFO] [15:20:59.766] Sensor Groovy CoberturaSensor done: 172 ms
[INFO] [15:20:59.768] Sensor CpdSensor...
[INFO] [15:20:59.768] SonarBridgeEngine is used
[INFO] [15:20:59.997] Sensor CpdSensor done: 229 ms
[INFO] [15:20:59.997] Sensor ProfileSensor...
(...)

It ends without any error.

How to reproduce:
1. Start clean (embedded) Sonar 3.4.1 with Groovy plugin
2. git clone git://github.com/szpak/code-examples-and-poc.git
3. cd parametrized-spock-pit-poc; mvn package sonar:sonar
-Dsonar.language=grvy -Dsonar.branch=groovy
4. check project page in Sonar

Should it work or there are some other limitation which prevents parsing
just Groovy classes in a Java and Groovy mixed code base?

Marcin


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: A lack of basic metrics for Groovy in a module containing also Java classes

Adam Waltman
Hi,

I think you need to specify the source folder, this is what the documentation says at the end of the page: http://docs.codehaus.org/display/SONAR/Groovy+Plugin

Btw - is it possible to have LCOM4 calculated for a Groovy project? I was not able to make it work.
Best regards,
Adam


Od: "Marcin Zajączkowski" <[hidden email]>
Do: [hidden email];
Wysłane: 17:48 Czwartek 2013-02-07
Temat: [sonar-user] A lack of basic metrics for Groovy in a module containing also Java classes

> Hi,
>
> I have Java and Groovy code mixed in one module. Because it is currently
> not supported in Sonar I wanted to make a standard (Java) project in
> Sonar and the second one with Groovy set as a language to get violations
> in Groovy code and maybe a code coverage of Groovy classes.
> Unfortunately the result of:
> mvn clean package sonar:sonar -Dsonar.language=grvy -Dsonar.branch=groovy
> (sonar.branch to not override the first measure)
> shows only test result, but no lines of code, classes, comments or
> duplication like in
> http://nemo.sonarsource.org/dashboard/index/org.codenarc:CodeNarc
>
> In a log I see that Sonar plugin starts with properly set parameters and
> use Groovy tools:
> [INFO] [15:20:33.450] Quality profile : [name=Sonar way,language=grvy]
> (...)
> [INFO] [15:20:36.991] Sensor CodeNarc done: 3193 ms
> [INFO] [15:20:36.991] Sensor GroovySensor...
> [INFO] [15:20:37.225] GMetrics completed: 135ms
> [INFO] [15:20:37.225] Sensor GroovySensor done: 234 ms
> (...)
> [INFO] [15:20:59.766] Sensor Groovy CoberturaSensor done: 172 ms
> [INFO] [15:20:59.768] Sensor CpdSensor...
> [INFO] [15:20:59.768] SonarBridgeEngine is used
> [INFO] [15:20:59.997] Sensor CpdSensor done: 229 ms
> [INFO] [15:20:59.997] Sensor ProfileSensor...
> (...)
>
> It ends without any error.
>
> How to reproduce:
> 1. Start clean (embedded) Sonar 3.4.1 with Groovy plugin
> 2. git clone git://github.com/szpak/code-examples-and-poc.git
> 3. cd parametrized-spock-pit-poc; mvn package sonar:sonar
> -Dsonar.language=grvy -Dsonar.branch=groovy
> 4. check project page in Sonar
>
> Should it work or there are some other limitation which prevents parsing
> just Groovy classes in a Java and Groovy mixed code base?
>
> Marcin
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>




---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: A lack of basic metrics for Groovy in a module containing also Java classes

Marcin Zajączkowski
On 2013-02-08 23:03, Adam Waltman wrote:
> Hi,
>
> I think you need to specify the source folder, this is what the documentation says at the end of the page: http://docs.codehaus.org/display/SONAR/Groovy+Plugin

Thanks for your reply, but I didn't help. In addition I don't see
setting sonar.sources in groovy-maven example project:
https://github.com/SonarSource/sonar-examples/blob/master/projects/languages/groovy/groovy-maven/pom.xml

When I checks in target/site/cobertura/coverage.xml there is calculated
coverage in both cases and a source directory is set correctly:
        <sources>

<source>/home/szpak/cosie/code/code-examples-and-poc/parametrized-spock-pit-poc/src/main/groovy</source>

<source>/home/szpak/cosie/code/code-examples-and-poc/parametrized-spock-pit-poc/src/main/java</source>
                <source>--source</source>
        </sources>
(I don't know why "--source", but in the example it also occurs)

Even when I set -Dsonar.sources=src/main/groovy,src/test/groovy the
source directories in cobertura reports are the same (and there is still
no data displayed in Sonar).

I wonder if it could be a problem that I use groovy-eclipse-compiler
with build-helper-maven-plugin instead of gmaven?
https://github.com/szpak/code-examples-and-poc/blob/master/parametrized-spock-pit-poc/pom.xml

Is that configuration supported?

Marcin



> Btw - is it possible to have LCOM4 calculated for a Groovy project? I was not able to make it work.
> Best regards,
> Adam
>
>
> Od: "Marcin Zajączkowski" <[hidden email]>
> Do: [hidden email];
> Wysłane: 17:48 Czwartek 2013-02-07
> Temat: [sonar-user] A lack of basic metrics for Groovy in a module containing also Java classes
>
>> Hi,
>>
>> I have Java and Groovy code mixed in one module. Because it is currently
>> not supported in Sonar I wanted to make a standard (Java) project in
>> Sonar and the second one with Groovy set as a language to get violations
>> in Groovy code and maybe a code coverage of Groovy classes.
>> Unfortunately the result of:
>> mvn clean package sonar:sonar -Dsonar.language=grvy -Dsonar.branch=groovy
>> (sonar.branch to not override the first measure)
>> shows only test result, but no lines of code, classes, comments or
>> duplication like in
>> http://nemo.sonarsource.org/dashboard/index/org.codenarc:CodeNarc
>>
>> In a log I see that Sonar plugin starts with properly set parameters and
>> use Groovy tools:
>> [INFO] [15:20:33.450] Quality profile : [name=Sonar way,language=grvy]
>> (...)
>> [INFO] [15:20:36.991] Sensor CodeNarc done: 3193 ms
>> [INFO] [15:20:36.991] Sensor GroovySensor...
>> [INFO] [15:20:37.225] GMetrics completed: 135ms
>> [INFO] [15:20:37.225] Sensor GroovySensor done: 234 ms
>> (...)
>> [INFO] [15:20:59.766] Sensor Groovy CoberturaSensor done: 172 ms
>> [INFO] [15:20:59.768] Sensor CpdSensor...
>> [INFO] [15:20:59.768] SonarBridgeEngine is used
>> [INFO] [15:20:59.997] Sensor CpdSensor done: 229 ms
>> [INFO] [15:20:59.997] Sensor ProfileSensor...
>> (...)
>>
>> It ends without any error.
>>
>> How to reproduce:
>> 1. Start clean (embedded) Sonar 3.4.1 with Groovy plugin
>> 2. git clone git://github.com/szpak/code-examples-and-poc.git
>> 3. cd parametrized-spock-pit-poc; mvn package sonar:sonar
>> -Dsonar.language=grvy -Dsonar.branch=groovy
>> 4. check project page in Sonar
>>
>> Should it work or there are some other limitation which prevents parsing
>> just Groovy classes in a Java and Groovy mixed code base?
>>
>> Marcin
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>
>


--
http://blog.solidsoft.info/ - Working code is not enough


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: A lack of basic metrics for Groovy in a module containing also Java classes

Adam Waltman
Hi,

I was referring to the line
    <sourceDirectory>src/main/groovy</sourceDirectory>
visible in  
   https://github.com/SonarSource/sonar-examples/blob/master/projects/languages/groovy/groovy-maven/pom.xml
Not sure if this will help and if this is relavant in your quite complex set up - I know I was missing it in our pom, even if the project was building fine without it - it was needed by Sonar.

Best regards,
Adam

Od: "Marcin Zajączkowski" <[hidden email]>
Do: [hidden email];
Wysłane: 8:00 Sobota 2013-02-09
Temat: Re: [sonar-user] A lack of basic metrics for Groovy in a module containing also Java classes

> On 2013-02-08 23:03, Adam Waltman wrote:
> > Hi,
> >
> > I think you need to specify the source folder, this is what the documentation says at the end of the page: http://docs.codehaus.org/display/SONAR/Groovy+Plugin
>
> Thanks for your reply, but I didn't help. In addition I don't see
> setting sonar.sources in groovy-maven example project:
> https://github.com/SonarSource/sonar-examples/blob/master/projects/languages/groovy/groovy-maven/pom.xml
>
> When I checks in target/site/cobertura/coverage.xml there is calculated
> coverage in both cases and a source directory is set correctly:
>        
>
> /home/szpak/cosie/code/code-examples-and-poc/parametrized-spock-pit-poc/src/main/groovy
>
> /home/szpak/cosie/code/code-examples-and-poc/parametrized-spock-pit-poc/src/main/java
>                 --source
>        
> (I don't know why "--source", but in the example it also occurs)
>
> Even when I set -Dsonar.sources=src/main/groovy,src/test/groovy the
> source directories in cobertura reports are the same (and there is still
> no data displayed in Sonar).
>
> I wonder if it could be a problem that I use groovy-eclipse-compiler
> with build-helper-maven-plugin instead of gmaven?
> https://github.com/szpak/code-examples-and-poc/blob/master/parametrized-spock-pit-poc/pom.xml
>
> Is that configuration supported?
>
> Marcin
>
>
>
> > Btw - is it possible to have LCOM4 calculated for a Groovy project? I was not able to make it work.
> > Best regards,
> > Adam
> >
> >
> > Od: "Marcin Zajączkowski"
> > Do: [hidden email];
> > Wysłane: 17:48 Czwartek 2013-02-07
> > Temat: [sonar-user] A lack of basic metrics for Groovy in a module containing also Java classes
> >
> >> Hi,
> >>
> >> I have Java and Groovy code mixed in one module. Because it is currently
> >> not supported in Sonar I wanted to make a standard (Java) project in
> >> Sonar and the second one with Groovy set as a language to get violations
> >> in Groovy code and maybe a code coverage of Groovy classes.
> >> Unfortunately the result of:
> >> mvn clean package sonar:sonar -Dsonar.language=grvy -Dsonar.branch=groovy
> >> (sonar.branch to not override the first measure)
> >> shows only test result, but no lines of code, classes, comments or
> >> duplication like in
> >> http://nemo.sonarsource.org/dashboard/index/org.codenarc:CodeNarc
> >>
> >> In a log I see that Sonar plugin starts with properly set parameters and
> >> use Groovy tools:
> >> [INFO] [15:20:33.450] Quality profile : [name=Sonar way,language=grvy]
> >> (...)
> >> [INFO] [15:20:36.991] Sensor CodeNarc done: 3193 ms
> >> [INFO] [15:20:36.991] Sensor GroovySensor...
> >> [INFO] [15:20:37.225] GMetrics completed: 135ms
> >> [INFO] [15:20:37.225] Sensor GroovySensor done: 234 ms
> >> (...)
> >> [INFO] [15:20:59.766] Sensor Groovy CoberturaSensor done: 172 ms
> >> [INFO] [15:20:59.768] Sensor CpdSensor...
> >> [INFO] [15:20:59.768] SonarBridgeEngine is used
> >> [INFO] [15:20:59.997] Sensor CpdSensor done: 229 ms
> >> [INFO] [15:20:59.997] Sensor ProfileSensor...
> >> (...)
> >>
> >> It ends without any error.
> >>
> >> How to reproduce:
> >> 1. Start clean (embedded) Sonar 3.4.1 with Groovy plugin
> >> 2. git clone git://github.com/szpak/code-examples-and-poc.git
> >> 3. cd parametrized-spock-pit-poc; mvn package sonar:sonar
> >> -Dsonar.language=grvy -Dsonar.branch=groovy
> >> 4. check project page in Sonar
> >>
> >> Should it work or there are some other limitation which prevents parsing
> >> just Groovy classes in a Java and Groovy mixed code base?
> >>
> >> Marcin
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe from this list, please visit:
> >>
> >>     http://xircles.codehaus.org/manage_email
> >>
> >>
> >>
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe from this list, please visit:
> >
> >     http://xircles.codehaus.org/manage_email
> >
> >
> >
> >
>
>
> --
> http://blog.solidsoft.info/ - Working code is not enough
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>




---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: A lack of basic metrics for Groovy in a module containing also Java classes

Marcin Zajączkowski
On 2013-02-09 20:24, Adam W wrote:
> Hi,
>
> I was referring to the line
>     <sourceDirectory>src/main/groovy</sourceDirectory>
> visible in  
>    https://github.com/SonarSource/sonar-examples/blob/master/projects/languages/groovy/groovy-maven/pom.xml
> Not sure if this will help and if this is relavant in your quite complex set up - I know I was missing it in our pom, even if the project was building fine without it - it was needed by Sonar.

Unfortunately I cannot set it to src/main/groovy because then Java
classes are not visible and the whole project has compilation errors.
I will try to take a look at plugin's source code or at least I will
report an issue related to not supporting adding source directories via
build-helper-maven-plugin.

Thanks anyway
Marcin


> Od: "Marcin Zajączkowski" <[hidden email]>
> Do: [hidden email];
> Wysłane: 8:00 Sobota 2013-02-09
> Temat: Re: [sonar-user] A lack of basic metrics for Groovy in a module containing also Java classes
>
>> On 2013-02-08 23:03, Adam Waltman wrote:
>>> Hi,
>>>
>>> I think you need to specify the source folder, this is what the documentation says at the end of the page: http://docs.codehaus.org/display/SONAR/Groovy+Plugin
>>
>> Thanks for your reply, but I didn't help. In addition I don't see
>> setting sonar.sources in groovy-maven example project:
>> https://github.com/SonarSource/sonar-examples/blob/master/projects/languages/groovy/groovy-maven/pom.xml
>>
>> When I checks in target/site/cobertura/coverage.xml there is calculated
>> coverage in both cases and a source directory is set correctly:
>>        
>>
>> /home/szpak/cosie/code/code-examples-and-poc/parametrized-spock-pit-poc/src/main/groovy
>>
>> /home/szpak/cosie/code/code-examples-and-poc/parametrized-spock-pit-poc/src/main/java
>>                 --source
>>        
>> (I don't know why "--source", but in the example it also occurs)
>>
>> Even when I set -Dsonar.sources=src/main/groovy,src/test/groovy the
>> source directories in cobertura reports are the same (and there is still
>> no data displayed in Sonar).
>>
>> I wonder if it could be a problem that I use groovy-eclipse-compiler
>> with build-helper-maven-plugin instead of gmaven?
>> https://github.com/szpak/code-examples-and-poc/blob/master/parametrized-spock-pit-poc/pom.xml
>>
>> Is that configuration supported?
>>
>> Marcin
>>
>>
>>
>>> Btw - is it possible to have LCOM4 calculated for a Groovy project? I was not able to make it work.
>>> Best regards,
>>> Adam
>>>
>>>
>>> Od: "Marcin Zajączkowski"
>>> Do: [hidden email];
>>> Wysłane: 17:48 Czwartek 2013-02-07
>>> Temat: [sonar-user] A lack of basic metrics for Groovy in a module containing also Java classes
>>>
>>>> Hi,
>>>>
>>>> I have Java and Groovy code mixed in one module. Because it is currently
>>>> not supported in Sonar I wanted to make a standard (Java) project in
>>>> Sonar and the second one with Groovy set as a language to get violations
>>>> in Groovy code and maybe a code coverage of Groovy classes.
>>>> Unfortunately the result of:
>>>> mvn clean package sonar:sonar -Dsonar.language=grvy -Dsonar.branch=groovy
>>>> (sonar.branch to not override the first measure)
>>>> shows only test result, but no lines of code, classes, comments or
>>>> duplication like in
>>>> http://nemo.sonarsource.org/dashboard/index/org.codenarc:CodeNarc
>>>>
>>>> In a log I see that Sonar plugin starts with properly set parameters and
>>>> use Groovy tools:
>>>> [INFO] [15:20:33.450] Quality profile : [name=Sonar way,language=grvy]
>>>> (...)
>>>> [INFO] [15:20:36.991] Sensor CodeNarc done: 3193 ms
>>>> [INFO] [15:20:36.991] Sensor GroovySensor...
>>>> [INFO] [15:20:37.225] GMetrics completed: 135ms
>>>> [INFO] [15:20:37.225] Sensor GroovySensor done: 234 ms
>>>> (...)
>>>> [INFO] [15:20:59.766] Sensor Groovy CoberturaSensor done: 172 ms
>>>> [INFO] [15:20:59.768] Sensor CpdSensor...
>>>> [INFO] [15:20:59.768] SonarBridgeEngine is used
>>>> [INFO] [15:20:59.997] Sensor CpdSensor done: 229 ms
>>>> [INFO] [15:20:59.997] Sensor ProfileSensor...
>>>> (...)
>>>>
>>>> It ends without any error.
>>>>
>>>> How to reproduce:
>>>> 1. Start clean (embedded) Sonar 3.4.1 with Groovy plugin
>>>> 2. git clone git://github.com/szpak/code-examples-and-poc.git
>>>> 3. cd parametrized-spock-pit-poc; mvn package sonar:sonar
>>>> -Dsonar.language=grvy -Dsonar.branch=groovy
>>>> 4. check project page in Sonar
>>>>
>>>> Should it work or there are some other limitation which prevents parsing
>>>> just Groovy classes in a Java and Groovy mixed code base?
>>>>
>>>> Marcin


--
http://blog.solidsoft.info/ - Working code is not enough


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email