-
Notifications
You must be signed in to change notification settings - Fork 363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
improve EXECUTABLE_LINES_DATA_KEY metrics support #1203
Comments
Hi @Bertk please have a look to the graphics at https://github.com/SonarOpenCommunity/sonar-cxx/wiki/Get-code-coverage-metrics. Seems that at least Bullseye provide also for functionDefinition, functionDeclSpecifierSeq, and declarator coverage information? One reason why VS coverage does typically not match to the numbers using VisualStudio is the "partial" coverage. |
Hi @Bertk see a sample in our code base with 100% coverage. First/last bracket from functionBody are covered. Think there is the code to create/destroy local variables. |
@guwirth Hi, thank you for the hints. Can you please share with me which coverage tool was used. |
@Bertk I agree. We have to handle
different. The only thing I'm not really sure is what are "executable lines":
Also don't know what would happen if we follow your proposal to mark only statements within function body and a coverage tool would provide "more coverage" (e.g. for functionDefinition, initializer lists, ...). Interesting is your sample above. functionDefinition is covered, initialisation list not (can't be) and also body not (can't also be)? |
I have created a small project for TFS vNext build tests with SonarQube and here the coverage looks like this (SQ6.5 and MSTest, MSCoverage). The coverage results should be displayed in SQ identical to Visual Studio Editor or Bullseye Coverage Browser. I do not know whether this can be achieved because multiple coverage tools are supported. |
@Bertk think there are two cases:
For me this means:
Implementation proposal:
|
@guwirth Hi, with the PR the result in SQ6.5 look like this: |
@Bertk you should also check the other case without report. Which lines are marked red ? |
Found some good description what is executable:
|
Below I tried to setup a table from my current knowledge.
Looking to the table there are two critical cases:
Reading also this I think marking a line executable should be very defensive: better to less than to much. |
CxxFileLinesVisitor should only consider source code lines from CxxGrammarImpl.functionBody for EXECUTABLE_LINES_DATA_KEY (Set executableLines).
The current implementation also adds functionDefinition, functionDeclSpecifierSeq, and declarator AST node for executable code lines.
Therefore the calculation of code coverage (%) is not correct.
The text was updated successfully, but these errors were encountered: