-
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
refactor CxxFileLinesVisitorTest #1426
Conversation
- only one assert per test - add constexpr in test file "ncloc.cc"
- show hits and condition per line - remove obsolete test
- conditional coverage is not supported with Microsoft coverage data
Solves issue #1425 |
@@ -122,7 +119,6 @@ private static void collectRangeMeasures(SMInputCursor function, Map<String, Cov | |||
coverageData.put(sourceId, builder); | |||
} | |||
|
|||
builder.setConditions(startLine - 1, conditions, coveredConditions); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Bertk don't understand why this is no more needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are 2 issues with this line:
- The calculation
startLine - 1
creates measures for wrong code lines - Microsoft coverage tool only provides block coverage but not branch coverage (selection statements). The indicator for partial covered condition cannot be set for the relevant code line but only for the code block and the code metric shows more conditions for a source file than conditions exists in the file itself.
A compromise is to remove the calculation and set condition for every block but this is a different way Visual Studio does it and should be avoided.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Bertk does this still fit to description in rdwiki https://github.com/SonarOpenCommunity/sonar-cxx/wiki/Get-code-coverage-metrics? |
@guwirth I updated the page and removed the invalid parts. |
This change is