galexandre / sonar-cobertura

Cobertura plugin for SonarQube
GNU General Public License v3.0
30 stars 26 forks source link

Coverage fails with wrong number of lines #11

Closed rohitstv1990 closed 7 years ago

rohitstv1990 commented 7 years ago

Hi Geoffrey We are facing this issue only with the functional code coverage. This scenario happens very frequently in case of functional code coverage If there is a difference in the line numbers in the coverage(xml) and the original file then the analysis is failing with the following exception : Error during Sonar runner execution org.sonar.runner.impl.RunnerException: Unable to execute Sonar at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91) at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75) at java.security.AccessController.doPrivileged(Native Method) at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69) at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50) at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102) at org.sonar.runner.api.Runner.execute(Runner.java:100) at org.sonar.runner.Main.executeTask(Main.java:70) at org.sonar.runner.Main.execute(Main.java:59) at org.sonar.runner.Main.main(Main.java:53) Caused by: java.lang.IllegalStateException: Can't create measure for line 173 for file '/jenkins/workspace/Coverage/FunctionalCodeCoverage/ConsolidatedFunctionalCodeCoverage/src/com/in/co/csp/cso/ims/reports/action/IMSReportsGeneralTabAction.java' with 169 lines

We think sonar analysis should not fail in case of functional code coverage even if there are some mismatch of line numbers for some file.

galexandre commented 7 years ago

Hi,

Can you describe a bit more the problem please? How can we reproduce it?

galexandre commented 7 years ago

Thanks for the description. I reviewed your code and can you apply some changes please?

I will accept the PR after these changes.

Regards,

Geoffrey

rohitstv1990 commented 7 years ago

Hi Geoffrey Thanks for the comments ,As suggested by you i have made the required changes please go through it and accept the same.

Regards Rohit

galexandre commented 7 years ago

Done

Thanks a lot !!

rohitstv1990 commented 7 years ago

Hi Geoffrey Thanks for accepting the pull request. Currently we are using sonarqube LTS 5.6.6, is it possible to have this fix updated in sonarqube update center UI?

Regards Rohit

galexandre commented 7 years ago

Hi,

I will try to do a new version ASAP.

Regards,

Geoffrey