SonarLint Plugin for Intellij/Android Studio Not working with SonarQube Community

  • Operating system: Windows 11/10
  • SonarLint plugin version: 7.0.0.52289
  • Is connected mode used: Yes
    • Connected to SonarCloud or SonarQube (and which version): SonarQube Community 9.6.0.59041

SonarLint Plugin can not be connected to SonarQube Community edition.
I tried to bind via Token and Id-Pass way but while syncing rules etc. it gives an error

  Error: Error 400 on /api/issues/pull?projectKey=<ProjectKeyHere>&branchName=&languages=web,java,js,kotlin,php,py,ruby,scala,secrets,swift,ts,xml: The 'branchName' parameter is missing

As this is a community edition I can’t use GIT analysis and I don’t want to. Any project key that I use is not working.

Also this is a vanilla installation.

Hello Raghav,

Thanks for posting here, I really appreciate!

We rely on JetBrains APIs to get the current branch name. In your case it seems an empty string is returned, which causes problems down the chain.

A few questions:

  1. Are you using IntelliJ or another flavor ?
  2. Which version ?

As this is a community edition I can’t use GIT analysis and I don’t want to.

  1. Does that mean you don’t use version control at all in your project ?

By the way Git is supported in community edition. Only Pull Request analysis is not

I am using Android Studio Electric Eel | 2022.1.1 Canary 9

I am using version control in my project, which is only local with no remotes. But don’t know how to set it up in SonarQube as I am a newbie.

Also thank you for replying

I’m facing the same issue with version 7.0.0.52289. When I downgraded to version 6.8.0.50884, I did not get the error message.

I’m running the latest version of IntelliJ:
IntelliJ IDEA 2022.2.1 (Ultimate Edition)
Build #IU-222.3739.54, built on August 16, 2022
Runtime version: 17.0.3+7-b469.37 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10 10.0
Non-Bundled Plugins:
google-java-format (1.15.0.0)
com.intellij.selenium (222.4005)
org.sonarlint.idea (6.8.0.50884)
CheckStyle-IDEA (5.70.0)
com.intellij.bigdatatools (222.3345.33)

And an on premise version of SonarQube CE: 9.6.0.59041

Hello Jan,

Thanks for jumping in :slight_smile:

Do you also use git in your project ? Does the error happen when you switch branch ? Could you please enable verbose logs, reproduce the problem and share the logs with us ?

Hey Damien,

Yes we use git (with on premise gitlab)

Strange thing happened. Because I was on 6.8.0.50884 and IntelliJ Idea did not let me update to the latest (do not know why), I decided to uninstall 6.8.0.50884, restart Idea, install 7.0.0.52289, restart Idea.

After having 7.0.0.52289 available, the error I previously saw did not occur anymore.

Also tested when switching branches (from within IntelliJ). All seems working now as expected. So I’m not able to reproduce the problem at the moment. As soon as I hit the problem again I will capture the logs.

The only explanation I can see is that your local storage is somehow corrupted. We locally cache server branches and this file might be broken.

If by chance you still face the problem Raghav, or if it comes back Jan, could you share with us the contents of this cache file ? It is located in your IDE System folder, generally under sonarlint/storage/XXXX/projects/YYYY/project_branches.pb.

A way to workaround the problem would be to remove this file (or even the full folder) and go to Settings > Tools > SonarLint > Project Settings > Update local storage.

Hope this helps

I will provide you logs once this happens again

1 Like

This happens when I freshly enable binding, I have attached video recording + logs for the same
Logs.txt (40.4 KB)
Screen Record.webm (15 MB)

project_branches.pb contents:

<0x06>master<0x12><0x06>master

A colleague of mine yesterday also faced this issue. After uninstall and install it was fixed for him also.

So indeed a corruption could be the problem.

Hey there;

Thanks to both of you! I managed to identify the cause of the problem, and created this ticket. It is fixed and we should release a new version soon.

Thanks again!

Thanks to you actually Damien :blush:. You have been really quick on everything

Hi Damien,
I hope you’re doing well.

Actually, I am also facing the same problem.

Versions:
Android Studio: Chipmunk 2021.2.1 Patch 1
SonarLint: 7.0.0.52289

Error when I first create connection with SonarQube:

> Error refreshing taint vulnerabilities
> java.lang.IllegalStateException: Error 400 on /api/issues/pull_taint?projectKey=Caremiles-Android&branchName=&languages=web,java,js,kotlin,php,py,ruby,scala,secrets,swift,ts,xml: The 'branchName' parameter is missing
> 	at org.sonarsource.sonarlint.core.serverapi.ServerApiHelper.handleError(ServerApiHelper.java:136)
> 	at org.sonarsource.sonarlint.core.serverapi.ServerApiHelper.get(ServerApiHelper.java:70)
> 	at org.sonarsource.sonarlint.core.serverapi.issue.IssueApi.lambda$pullTaintIssues$9(IssueApi.java:223)
> 	at org.sonarsource.sonarlint.core.serverapi.ServerApiHelper.processTimed(ServerApiHelper.java:225)
> 	at org.sonarsource.sonarlint.core.serverapi.issue.IssueApi.pullTaintIssues(IssueApi.java:222)
> 	at org.sonarsource.sonarlint.core.serverconnection.TaintIssueDownloader.downloadTaintFromPull(TaintIssueDownloader.java:93)
> 	at org.sonarsource.sonarlint.core.serverconnection.ServerIssueUpdater.syncTaints(ServerIssueUpdater.java:65)
> 	at org.sonarsource.sonarlint.core.serverconnection.ServerConnection.syncServerTaintIssuesForProject(ServerConnection.java:206)
> 	at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.syncServerTaintIssues(ConnectedSonarLintEngineImpl.java:445)
> 	at org.sonarlint.intellij.issue.vulnerabilities.TaintVulnerabilitiesPresenter.syncTaintVulnerabilitiesFor$lambda-2(TaintVulnerabilitiesPresenter.kt:99)
> 	at java.base/java.util.Optional.ifPresent(Optional.java:183)
> 	at org.sonarlint.intellij.issue.vulnerabilities.TaintVulnerabilitiesPresenter.syncTaintVulnerabilitiesFor(TaintVulnerabilitiesPresenter.kt:97)
> 	at org.sonarlint.intellij.issue.vulnerabilities.TaintVulnerabilitiesPresenter.refreshTaintVulnerabilitiesForOpenFiles(TaintVulnerabilitiesPresenter.kt:74)
> 	at org.sonarlint.intellij.issue.vulnerabilities.TaintVulnerabilitiesPresenter$refreshTaintVulnerabilitiesForOpenFilesAsync$1.run(TaintVulnerabilitiesPresenter.kt:66)
> 	at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:450)
> 	at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:117)
> 	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsync$5(CoreProgressManager.java:510)
> 	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$3(ProgressRunner.java:243)
> 	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:183)
> 	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:705)
> 	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:647)
> 	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:63)
> 	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:170)
> 	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:243)
> 	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700)
> 	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
> 	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
> 	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
> 	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
> 	at java.base/java.security.AccessController.doPrivileged(Native Method)
> 	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
> 	at java.base/java.lang.Thread.run(Thread.java:829)

Error after doing your suggested workaround:
A way to workaround the problem would be to remove this file (or even the full folder) and go to Settings > Tools > SonarLint > Project Settings > Update local storage.

> Downloaded plugin list in 265ms
> [SYNC] Synchronizing analyzer configuration for project 'Caremiles-Android'
> Downloaded settings in 329ms
> [SYNC] Fetching rule set for language 'java' from profile 'AYLPjziTEevrcnx5PP4-'
> [SYNC] Fetching rule set for language 'js' from profile 'AYLPjzSvEevrcnx5PPQh'
> [SYNC] Fetching rule set for language 'kotlin' from profile 'AYLPjzPmEevrcnx5PPIn'
> [SYNC] Fetching rule set for language 'php' from profile 'AYLPjzraEevrcnx5PQKu'
> [SYNC] Fetching rule set for language 'py' from profile 'AYLPjzWsEevrcnx5PPZF'
> [SYNC] Fetching rule set for language 'ruby' from profile 'AYLPjzZzEevrcnx5PPcu'
> [SYNC] Fetching rule set for language 'scala' from profile 'AYLPjzL0Eevrcnx5PPEA'
> [SYNC] Fetching rule set for language 'ts' from profile 'AYLPjz8FEevrcnx5PQfq'
> [SYNC] Fetching rule set for language 'web' from profile 'AYLPjzl4Eevrcnx5PQBY'
> [SYNC] Fetching rule set for language 'xml' from profile 'AYLPjzpWEevrcnx5PQE-'
> [SYNC] Synchronizing project branches for project 'Caremiles-Android'
> [SYNC] Synchronizing taint issues for project 'Caremiles-Android' on branch 'master'
> Clearing all issues because binding was updated
> Using connection 'Sonar-Arpatech' for project 'Caremiles-Android'
> Analysing 'build.gradle'...
> Using connection 'Sonar-Arpatech' for project 'Caremiles-Android'
> Analysing 'build.gradle'...
> Found 0 issues

Thanks

Hello here,

We just released a new version on the marketplace that should fix this problem. Feel free to update and report back if you have any issue.

Thanks again for reporting :slight_smile:

EDIT: @RJ_Satyadev don’t hesitate to re-evaluate your rating on the Marketplace :wink:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.