-
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
Add fallback for 'reactor' report search in CxxCoverageSensor #516
Conversation
All other Sensor classes inherit a 'reports.isEmpty()' check in CxxReportSensor to revert from the reactor-based root directory to a local root directory when searching for reports. This adds the same check to the three types of coverage reports.
Someone else having mixed Java/C++ project could test this? |
It should apply to any language, but I guess this should be considered to On Wed, May 20, 2015, 22:47 Günter Wirth [email protected] wrote:
|
Yeah, I'm not sure it's specific to the languages, but more the hierarchical nature of our project. Take something like this, where each
If you run the SonarQube analysis from I guess part of the problem is we're a fully Maven-based project, with properties carried through the |
Yep this the expected behavior currently. The idea was to make sure the On Thu, May 21, 2015, 00:05 Peter van Zetten [email protected]
|
@Bertk I think you are the second one using this multi-module thing. Does this work for you? |
Perhaps a more abstract way of searching for reports would be a better way of approaching this. All of the other sensors make use of the If the report search were extracted to a general This way any future work on the report matching will be in the same place, and the CxxCoverageSensor won't be left out. |
On inspection, that's actually quite a hefty bit of refactoring. If it's wanted I can slog through it, but consolidating and straightening out report matching will force us to modify a fair few other classes and tests. The already-submitted fix to CxxCoverageSensor is certainly a lower-impact fix. |
Yep, pretty much all sensors require this. Perhaps when core decides to On Thu, May 21, 2015, 15:29 Peter van Zetten [email protected]
|
I also found this issue but did not create a PR until now. Please check another small impact solution on this branch https://github.com/Bertk/sonar-cxx/blob/Bert/sonar-cxx-plugin/src/main/java/org/sonar/plugins/cxx/coverage/CxxCoverageSensor.java. |
The commit from @Bertk is basically exactly the same as mine, except the search/re-search construct was extracted into a separate method. The Exception thing is actually a bit more interesting though. In CxxReportSensor the reactor path is found with So my commit is really a bare-minimum change to CxxCoverageSensor; literally just adding for each reports search "if empty, search in project baseDir". I think it stands pretty well on its own. If the desired approach is to extract the reports search/fallback to its own method with error checking/logging I'd rather do it for all sensors and refactor it fully. |
Please check the URL http://stackoverflow.com/questions/1099300/whats-the-difference-between-getpath-getabsolutepath-and-getcanonicalpath. There is a nice description for |
I merge this as a bugfix. Fell free to refactor the code. |
Add fallback for 'reactor' report search in CxxCoverageSensor
Our mixed Java/C++ project setup follows quite a traditional multi-module Maven project configuration, but the reactor changes introduced in e714d3e break the CxxCoverageSensor for us.
It's no longer possible to use a relative report path for
sonar.cxx.coverage.reportPath
such astarget/gcovr/report.xml
in a multi-module project. This filter is used from the reactor root (reactor.getRoot().getBaseDir().getAbsolutePath()
) and won't match the individual module reports.All other Sensor classes inherit a
reports.isEmpty()
check from CxxReportSensor to revert from the reactor-based root directory to a local root directory when searching for reports, so other sensors are not affected by this.This commit adds the same check to the three types of coverage reports.