mc1arke / sonarqube-community-branch-plugin

A plugin that allows branch analysis and pull request decoration in the Community version of Sonarqube
GNU Lesser General Public License v3.0
2.22k stars 521 forks source link

Gitlab PR decoration don't work anymore #335

Closed LaSylv closed 3 years ago

LaSylv commented 3 years ago

Describe the bug Gitlab PR decoration is failing

To Reproduce Configure gitlab PR decoration Expected behavior No ERROR/failing

Software Versions

Additional context


2021.04.12 08:45:23 ERROR ce[AXjFQa7dboEK8z4slOrP][o.s.c.t.p.a.p.PostProjectAnalysisTasksExecutor] Execution of task class com.github.mc1arke.sonarqube.plugin.ce.pullrequest.PullRequestPostAnalysisTask failed
java.lang.IllegalArgumentException: Cannot format given Object as a Number
    at java.base/java.text.DecimalFormat.format(Unknown Source)
    at java.base/java.text.Format.format(Unknown Source)
    at com.github.mc1arke.sonarqube.plugin.ce.pullrequest.AnalysisDetails.createAnalysisSummary(AnalysisDetails.java:207)
    at com.github.mc1arke.sonarqube.plugin.ce.pullrequest.gitlab.GitlabServerPullRequestDecorator.decorateQualityGateStatus(GitlabServerPullRequestDecorator.java:171)
    at com.github.mc1arke.sonarqube.plugin.ce.pullrequest.PullRequestPostAnalysisTask.finished(PullRequestPostAnalysisTask.java:160)
    at org.sonar.ce.task.projectanalysis.api.posttask.PostProjectAnalysisTasksExecutor.executeTask(PostProjectAnalysisTasksExecutor.java:118)
    at org.sonar.ce.task.projectanalysis.api.posttask.PostProjectAnalysisTasksExecutor.finished(PostProjectAnalysisTasksExecutor.java:109)
    at org.sonar.ce.task.step.ComputationStepExecutor.executeListener(ComputationStepExecutor.java:91)
    at org.sonar.ce.task.step.ComputationStepExecutor.execute(ComputationStepExecutor.java:63)
    at org.sonar.ce.task.projectanalysis.taskprocessor.ReportTaskProcessor.process(ReportTaskProcessor.java:81)
    at org.sonar.ce.taskprocessor.CeWorkerImpl$ExecuteTask.executeTask(CeWorkerImpl.java:235)
    at org.sonar.ce.taskprocessor.CeWorkerImpl$ExecuteTask.run(CeWorkerImpl.java:217)
    at org.sonar.ce.taskprocessor.CeWorkerImpl.findAndProcessTask(CeWorkerImpl.java:162)
    at org.sonar.ce.taskprocessor.CeWorkerImpl$TrackRunningState.get(CeWorkerImpl.java:137)
    at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:89)
    at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:53)
    at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125)
    at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:69)
    at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
    at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.base/java.lang.Thread.run(Unknown Source)

If you have any hint on why this is happening I can try to fix this

Rakdos8 commented 3 years ago

Sonar version : 8.8.0.42792 Plugin version : 1.7.0

I ran in the same issue on a grovvy project. But my Java project is still working. I've a bit checked the stack trace and it fails there : https://github.com/mc1arke/sonarqube-community-branch-plugin/blob/master/src/main/java/com/github/mc1arke/sonarqube/plugin/ce/pullrequest/AnalysisDetails.java#L207 on decimalFormat.format(coverage). I don't understand why though because coverage is a BigDecimal (so a Number) or is null. If it's null, it's not an Object.

mc1arke commented 3 years ago

Fixed in 1.8.0 of the plugin

nishwalshetty commented 2 years ago

@mc1arke i see the same issue with sonarqube 9.5 and plugin version 1.12.0.

couple of observations:

1 . works fine when change is in files whose language is recognized by sonarqube but when the pull request has changes to a shell script/Jenkinsfile it is not posting any comment maybe becuase there is no language for these files in sonarqube but the expectation is that it will post a success status check and sucessful comment in pr.

  1. i installed shell check plugin and rerun it starts decorating the pull request.

question : if the language of the changes file is not available in sonarqube then plugin will not post any comment/status ?