VinodAnandan / sonar-pitest

43 stars 30 forks source link

fix for issue #8, enable pitest plugin on sonarqube 5.4 #9

Closed gmuecke closed 7 years ago

gmuecke commented 8 years ago

I put together a fix for issue, the main aspects are

thomas-mc-work commented 8 years ago

Hi Gerald,

I appreciate your work very much! I've tested your fork in my environment and encountered an issue in one of my projects. Here is the output of the sonarqube log:

2016.05.09 09:51:54 ERROR [o.s.s.c.t.CeWorkerCallableImpl] Failed to execute task AVSUgDdAcnqxdzrg0rvP
org.sonar.server.computation.component.VisitException: Visit of Component {key=de.tln:lib-aegis-batch:src/main/java/de/tln/lib/aegis/batch/spi,type=DIRECTORY} failed
    at org.sonar.server.computation.component.VisitException.rethrowOrWrap(VisitException.java:44) ~[sonar-server-5.4.jar:na]
    at org.sonar.server.computation.component.VisitorsCrawler.visit(VisitorsCrawler.java:64) ~[sonar-server-5.4.jar:na]
    at org.sonar.server.computation.component.VisitorsCrawler.visitChildren(VisitorsCrawler.java:100) ~[sonar-server-5.4.jar:na]
    at org.sonar.server.computation.component.VisitorsCrawler.visitImpl(VisitorsCrawler.java:87) ~[sonar-server-5.4.jar:na]
    at org.sonar.server.computation.component.VisitorsCrawler.visit(VisitorsCrawler.java:62) ~[sonar-server-5.4.jar:na]
    at org.sonar.server.computation.step.ExecuteVisitorsStep.execute(ExecuteVisitorsStep.java:50) ~[sonar-server-5.4.jar:na]
    at org.sonar.server.computation.step.ComputationStepExecutor.execute(ComputationStepExecutor.java:39) ~[sonar-server-5.4.jar:na]
    at org.sonar.server.computation.taskprocessor.report.ReportTaskProcessor.process(ReportTaskProcessor.java:72) ~[sonar-server-5.4.jar:na]
    at org.sonar.server.computation.taskprocessor.CeWorkerCallableImpl.executeTask(CeWorkerCallableImpl.java:80) [sonar-server-5.4.jar:na]
    at org.sonar.server.computation.taskprocessor.CeWorkerCallableImpl.call(CeWorkerCallableImpl.java:55) [sonar-server-5.4.jar:na]
    at org.sonar.server.computation.taskprocessor.CeWorkerCallableImpl.call(CeWorkerCallableImpl.java:34) [sonar-server-5.4.jar:na]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_77]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_77]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_77]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_77]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.8.0_77]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_77]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_77]
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_77]
Caused by: java.lang.NullPointerException: null
    at org.sonar.plugins.pitest.PitestCoverageComputer.compute(PitestCoverageComputer.java:45) ~[na:na]
    at org.sonar.server.computation.measure.MeasureComputersVisitor.visitAny(MeasureComputersVisitor.java:65) ~[sonar-server-5.4.jar:na]
    at org.sonar.server.computation.component.TypeAwareVisitorWrapper.visitAny(TypeAwareVisitorWrapper.java:82) ~[sonar-server-5.4.jar:na]
    at org.sonar.server.computation.component.VisitorsCrawler.visitNode(VisitorsCrawler.java:107) ~[sonar-server-5.4.jar:na]
    at org.sonar.server.computation.component.VisitorsCrawler.visitImpl(VisitorsCrawler.java:90) ~[sonar-server-5.4.jar:na]
    at org.sonar.server.computation.component.VisitorsCrawler.visit(VisitorsCrawler.java:62) ~[sonar-server-5.4.jar:na]
    ... 17 common frames omitted

Do you have an idea what this is about?

My environment: Analysis is invoked by jenkins 1.651.1, SonarQube Plugin 2.4, sonar-maven-plugin 3.0.1 I'm injecting the environment vars into each project. Sonarqube server is version 5.4, JavaPlugin 3.13.1, pitest plugin is directly from your fork.

I hope this helps!

gmuecke commented 8 years ago

Hi Thomas, I believe the NPE occurs because the context does not contain a measure for MUTATIONS_DETECTED. I've added a null check, so the NPE should not occur anymore. Could you please verify, if your project contains any mutations (generate a pitest html report to compare).

Gerald

thomas-mc-work commented 8 years ago

Fantastic, it works!

besides that: does this version also work with the recent sonarqube 5.5?

reftel commented 8 years ago

Works for me on SQ 5.5 =)

Thanks!

thomas-mc-work commented 8 years ago

I've encountered another issue. I've included the pitest rule "Mutations Coverage" as a condition in my quality gate. Now when it fails then the name of the rule isn't properly resolved on the project dashboard:

screenshot - 11 05 2016 - 09 31 15

gmuecke commented 8 years ago

Hi Thomas,

the name of metric is properly configured as defined by the example plugins. The quality gate widget on the dashboard (the ones you can configure) shows a proper name for the metric. I might be, that this is an issue of the project overview. What version are you using? 5.4 or 5.5?

thomas-mc-work commented 8 years ago

5.4

timwebster9 commented 8 years ago

Does anyone know why these pull requests aren't getting merged? We have SonarQube v5.2 and would like to use this plugin, but it's not clear whether I should be using this version or @gmuecke's fork...

tgolden-andplus commented 8 years ago

SonarQube 6.0 is now available for download. Will this PR need to be updated again for the new major version? If so, can we at least merge the current version to have this plugin work on the LTS version of SonarQube?

alexvictoor commented 7 years ago

Thanks for the PR Sorry for the long delay, I have missed the notification. I will try to merge it and upgrade to 5.6 asap

alexvictoor commented 7 years ago

PR merged Thanks again

tgolden-andplus commented 7 years ago

This is great! Any timeline on when a new version will be available in the update center?

aleitamar commented 7 years ago

Is it also merged for version 6.X?

Thanks

gmuecke commented 7 years ago

I don't think it'll run on 6.x without further modifications, there had been some more api changes.