[sonar-dev] How to get coverage information on a single line

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[sonar-dev] How to get coverage information on a single line

ThPfe
This post was updated on .
Hi,

I am writing a Decorator that needs to know which lines of a file are covered and which are not. This returns null:

context.getMeasure(CoreMetrics.LINE_COVERAGE)

I'm not suprised that this doesn't work, since I didn't pass any specific line anyways. How can I get line coverage information in a decorator?

Note: A Coverage report is given to and displayed by SonarQube


Thanks in advance,
Thomas
Reply | Threaded
Open this post in threaded view
|

Re: [sonar-dev] How to get coverage information on a single line

ThPfe
I found the solution myself. The @DependsUpon annotation is necessary to assure the right execution order of Decorators (see here).

Furthermore the Metric COVERAGE_LINE_HITS_DATA returns key value pairs of line hits, while LINE_COVERAGE returns overall file coverage only.
Reply | Threaded
Open this post in threaded view
|

Re: [sonar-dev] How to get coverage information on a single line

Simon Brandhof
Exact. Note that you can use the class org.sonar.api.utils.KeyValueFormat to parse the pairs.

Regards


Simon BRANDHOF | SonarSource
http://twitter.com/SimonBrandhof

On 1 February 2015 at 14:55, ThPfe <[hidden email]> wrote:
I found the solution myself. The @DependsUpon annotation is necessary to
assure the right execution order of Decorators ( see here
<http://sonarqube.15.x6.nabble.com/sonar-dev-DependsUpon-Annotation-question-tp5007217.html>
).

Furthermore the Metric COVERAGE_LINE_HITS_DATA returns key value pairs of
line hits, while LINE_COVERAGE returns overall file coverage only.



--
View this message in context: http://sonarqube.15.x6.nabble.com/sonar-dev-How-to-get-coverage-information-on-a-single-line-tp5032068p5032090.html
Sent from the SonarQube Developers mailing list archive at Nabble.com.

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

    http://xircles.codehaus.org/manage_email