How can sync Sonarqube quality profile with Sonarlint for VS Code

Hello,I have added the connection settings for sonarqube server and projectkey also. on doing update all bindings i am getting response as “All SonarLint bindings succesfully updated” but Found 0 issues。

SonarLint Version:v3.3.3
VS code version:January 2022 (version 1.64)
SonarQube Version: Community Edition Version 9.3

demo.zip (335.3 KB)

settings.json

{
  "sonarlint.pathToNodeExecutable": "/usr/local/bin/node",
  "sonarlint.ls.javaHome": "/Library/Java/JavaVirtualMachines/jdk-14.jdk/Contents/Home",
  "sonarlint.connectedMode.connections.sonarqube": [
      {
          "connectionId": "sonar",
          "serverUrl": "http://localhost:9000",
          "token": "e0aa7832c9a7fb04cd728b698f740dfbff831ef6"
      }
  ],
  "sonarlint.connectedMode.project": {
      "connectionId": "sonar",
      "projectKey": "demo"
  },
  "sonarlint.output.showAnalyzerLogs": true,
  "sonarlint.output.showVerboseLogs": true,
  "eslint.enable": false
}

Sonarqube not connected

sonarqube connected



Web:FrameWithoutTitleCheck

[Debug - 20:10:20.356] Page downloaded in 40ms
[Info  - 20:10:20.360] Local storage status for connection with id 'sonar': org.sonarsource.sonarlint.core.container.model.DefaultGlobalStorageStatus@748f730b
[Debug - 20:10:20.386] Page downloaded in 24ms
[Debug - 20:10:20.415] GET 200 http://localhost:9000/batch/issues?key=demo | response time=28ms
[Debug - 20:10:20.415] Downloaded issues in 28ms
[Debug - 20:10:20.440] Page downloaded in 24ms
[Debug - 20:10:20.443] Queuing analysis of file 'file:///Users/luoyong/Desktop/demo/demo.html'
[Debug - 20:10:20.446] Resolved binding ProjectBinding[idePathPrefix=,projectKey=demo,sqPathPrefix=] for folder /Users/luoyong/Desktop/demo
[Info  - 20:10:20.447] Analyzing file 'file:///Users/luoyong/Desktop/demo/demo.html'...
[Debug - 20:10:20.448] Analysis triggered on 'file:///Users/luoyong/Desktop/demo/demo.html' with configuration:
[
  projectKey: demo
  baseDir: /Users/luoyong/Desktop/demo
  extraProperties: {}
  moduleKey: file:///Users/luoyong/Desktop/demo
  inputFiles: [
    file:///Users/luoyong/Desktop/demo/demo.html (UTF-8) [web]
  ]
]

[Debug - 20:10:20.464] Start analysis
[Info  - 20:10:20.466] Index files
[Debug - 20:10:20.467] Language of file 'file:///Users/luoyong/Desktop/demo/demo.html' is set to 'HTML'
[Info  - 20:10:20.467] 1 file indexed
[Debug - 20:10:20.479] 'JavaSensor' skipped because there is no related files in the current project
[Debug - 20:10:20.479] 'JavaScript analysis' skipped because there is no related files in the current project
[Debug - 20:10:20.479] 'TypeScript analysis' skipped because there is no related files in the current project
[Debug - 20:10:20.480] 'Python Sensor' skipped because there is no related files in the current project
[Debug - 20:10:20.480] Execute Sensor: HTML
[Debug - 20:10:20.481] HtmlSensor: [uri=file:///Users/luoyong/Desktop/demo/demo.html]: 2,0,0
[Debug - 20:10:20.481] 'XML Sensor' skipped because there is no related files in the current project
[Debug - 20:10:20.482] 'PHP sensor' skipped because there is no related files in the current project
[Debug - 20:10:20.482] 'Analyzer for "php.ini" files' skipped because there is no related files in the current project
[Debug - 20:10:20.482] Execute Sensor: Sonar Secrets Detection Sensor
[Info  - 20:10:20.487] Found 0 issues

this is my version of the SonarQube plugin installed on the server

{
	"plugins": [{
		"key": "csharp",
		"name": "C# Code Quality and Security",
		"description": "Code Analyzer for C#",
		"version": "8.34 (build 42011)",
		"license": "GNU LGPL 3",
		"organizationName": "SonarSource",
		"organizationUrl": "http://www.sonarsource.com",
		"editionBundled": false,
		"homepageUrl": "http://redirect.sonarsource.com/plugins/csharp.html",
		"issueTrackerUrl": "https://github.com/SonarSource/sonar-dotnet/issues",
		"implementationBuild": "7e01861b987ff6ebaef0ce378b5d90a3c8012f96",
		"filename": "sonar-csharp-plugin-8.34.0.42011.jar",
		"hash": "efa26d4d21db2cb94b45dbc2579242a0",
		"sonarLintSupported": false,
		"documentationPath": "static/documentation.md",
		"updatedAt": 1645664304005
	}, {
		"key": "config",
		"name": "Configuration detection fot Code Quality and Security",
		"description": "Plugin indexing common configuration files",
		"version": "1.2 (build 267)",
		"license": "GNU LGPL 3",
		"organizationName": "SonarSource",
		"organizationUrl": "https://www.sonarsource.com",
		"editionBundled": false,
		"homepageUrl": "http://docs.sonarqube.org/display/PLUG/Plugin+Library/sonar-config/sonar-config-plugin",
		"issueTrackerUrl": "https://jira.sonarsource.com/browse/SONARCONF",
		"implementationBuild": "4f37ba9ffb37a96d5883e52ad392ed32c5c6eaab",
		"filename": "sonar-config-plugin-1.2.0.267.jar",
		"hash": "276619b656c2bb54288951fcaf34e31a",
		"sonarLintSupported": false,
		"updatedAt": 1645664304005
	}, {
		"key": "flex",
		"name": "Flex Code Quality and Security",
		"description": "Code Quality and Security for Flex / ActionScript",
		"version": "2.7 (build 2865)",
		"license": "GNU LGPL 3",
		"organizationName": "SonarSource",
		"organizationUrl": "http://www.sonarsource.com",
		"editionBundled": false,
		"homepageUrl": "http://redirect.sonarsource.com/plugins/flex.html",
		"issueTrackerUrl": "http://jira.sonarsource.com/browse/SONARFLEX",
		"implementationBuild": "9e61d9774455b25eefd0b71bf8903cb030641864",
		"filename": "sonar-flex-plugin-2.7.0.2865.jar",
		"hash": "9cf78e1f33634604df27546a25ce5b8c",
		"sonarLintSupported": false,
		"documentationPath": "static/documentation.md",
		"updatedAt": 1645664304005
	}, {
		"key": "go",
		"name": "Go Code Quality and Security",
		"description": "Code Analyzer for Go",
		"version": "1.9.0 (build 3429)",
		"license": "GNU LGPL 3",
		"organizationName": "SonarSource",
		"organizationUrl": "http://www.sonarsource.com",
		"editionBundled": false,
		"homepageUrl": "http://redirect.sonarsource.com/plugins/go.html",
		"issueTrackerUrl": "https://jira.sonarsource.com/browse/SONARSLANG",
		"implementationBuild": "faf3c08c0ebf3a877186442cd4a0ddd50de079a8",
		"filename": "sonar-go-plugin-1.9.0.3429.jar",
		"hash": "7e21ced5d7d08b48af7daae06e57e2bf",
		"sonarLintSupported": false,
		"documentationPath": "static/documentation.md",
		"updatedAt": 1645664304005
	}, {
		"key": "web",
		"name": "HTML Code Quality and Security",
		"description": "Code analyzer for HTML",
		"version": "3.6 (build 3106)",
		"license": "The Apache Software License, Version 2.0",
		"organizationName": "SonarSource and Matthijs Galesloot",
		"editionBundled": false,
		"homepageUrl": "http://redirect.sonarsource.com/plugins/web.html",
		"issueTrackerUrl": "https://jira.sonarsource.com/browse/SONARHTML",
		"implementationBuild": "963bdc9f051f5dcb698b418790364231aeea04f2",
		"filename": "sonar-html-plugin-3.6.0.3106.jar",
		"hash": "723f570db21c05405b1d27b80cbad49f",
		"sonarLintSupported": true,
		"documentationPath": "static/documentation.md",
		"updatedAt": 1645664304005
	}, {
		"key": "iac",
		"name": "IaC Code Quality and Security",
		"description": "Code Analyzer for IaC",
		"version": "1.5 (build 1600)",
		"license": "SonarSource",
		"organizationName": "SonarSource",
		"organizationUrl": "https://www.sonarsource.com",
		"editionBundled": true,
		"homepageUrl": "http://docs.sonarqube.org/display/PLUG/Plugin+Library/iac/sonar-iac-plugin",
		"issueTrackerUrl": "https://jira.sonarsource.com/projects/SONARIAC",
		"implementationBuild": "49f85d3bb8f38ae65ec0edf4fc109761e68fb488",
		"filename": "sonar-iac-plugin-1.5.0.1600.jar",
		"hash": "d655239c15b8e24591ed3f8b7b4abcbd",
		"sonarLintSupported": false,
		"documentationPath": "static/documentation.md",
		"updatedAt": 1645664304005
	}, {
		"key": "jacoco",
		"name": "JaCoCo",
		"description": "JaCoCo XML report importer",
		"version": "1.1.1 (build 1157)",
		"license": "GNU LGPL 3",
		"organizationName": "SonarSource",
		"organizationUrl": "http://www.sonarsource.com",
		"editionBundled": false,
		"issueTrackerUrl": "https://jira.sonarsource.com/browse/JACOCO",
		"implementationBuild": "83478572b9f23efac29de15e30c7758bbb0c0e47",
		"filename": "sonar-jacoco-plugin-1.1.1.1157.jar",
		"hash": "c3b0852dcc82e97e572ca0812c0afd7d",
		"sonarLintSupported": false,
		"updatedAt": 1645664304005
	}, {
		"key": "java",
		"name": "Java Code Quality and Security",
		"description": "Code Analyzer for Java",
		"version": "7.7 (build 28547)",
		"license": "GNU LGPL 3",
		"organizationName": "SonarSource",
		"organizationUrl": "http://www.sonarsource.com",
		"editionBundled": false,
		"homepageUrl": "http://redirect.sonarsource.com/plugins/java.html",
		"issueTrackerUrl": "https://jira.sonarsource.com/browse/SONARJAVA",
		"implementationBuild": "be7b25484ea63cc345b695fc5b1d40ccacc3e0b6",
		"filename": "sonar-java-plugin-7.7.0.28547.jar",
		"hash": "ef57ab91d15a2b076c82146c47b6ccc5",
		"sonarLintSupported": true,
		"documentationPath": "static/documentation.md",
		"updatedAt": 1645664304005
	}, {
		"key": "javascript",
		"name": "JavaScript/TypeScript Code Quality and Security",
		"description": "Code Analyzer for JavaScript",
		"version": "8.8 (build 17228)",
		"license": "GNU LGPL 3",
		"organizationName": "SonarSource and Eriks Nukis",
		"editionBundled": false,
		"homepageUrl": "http://redirect.sonarsource.com/plugins/javascript.html",
		"issueTrackerUrl": "https://github.com/SonarSource/sonar-javascript/issues",
		"implementationBuild": "a3815936a51aa720d54bf0e04a9e351c3c0ad642",
		"filename": "sonar-javascript-plugin-8.8.0.17228.jar",
		"hash": "71a697ad27dd56d924ff3a1c1f9537d9",
		"sonarLintSupported": true,
		"documentationPath": "static/documentation.md",
		"updatedAt": 1645664304005
	}, {
		"key": "kotlin",
		"name": "Kotlin Code Quality and Security",
		"description": "Code Analyzer for Kotlin",
		"version": "2.9.0 (build 1147)",
		"license": "GNU LGPL 3",
		"organizationName": "SonarSource",
		"organizationUrl": "http to//www.sonarsource.com",
		"editionBundled": false,
		"homepageUrl": "http to//redirect.sonarsource.com/plugins/kotlin.html",
		"issueTrackerUrl": "https to//jira.sonarsource.com/browse/SONARKT",
		"implementationBuild": "6ce439214a685d4aabde6461fd609a9a9c1df1c6",
		"filename": "sonar-kotlin-plugin-2.9.0.1147.jar",
		"hash": "9c36d078b1865c1bc8463f5871e83782",
		"sonarLintSupported": true,
		"documentationPath": "static/documentation.md",
		"updatedAt": 1645664304005
	}, {
		"key": "php",
		"name": "PHP Code Quality and Security",
		"description": "Code Analyzer for PHP",
		"version": "3.22.1 (build 8626)",
		"license": "GNU LGPL v3",
		"organizationName": "SonarSource and Akram Ben Aissi",
		"editionBundled": false,
		"homepageUrl": "http://redirect.sonarsource.com/plugins/php.html",
		"issueTrackerUrl": "https://jira.sonarsource.com/projects/SONARPHP",
		"implementationBuild": "68787fc2bf0b446b0fa5e3c1943ee14fd91ee79d",
		"filename": "sonar-php-plugin-3.22.1.8626.jar",
		"hash": "537ebba67c3f8b3989e8664a2ba97629",
		"sonarLintSupported": true,
		"documentationPath": "static/documentation.md",
		"updatedAt": 1645664304005
	}, {
		"key": "python",
		"name": "Python Code Quality and Security",
		"description": "Code Analyzer for Python",
		"version": "3.9 (build 9230)",
		"license": "GNU LGPL 3",
		"organizationName": "SonarSource and Waleri Enns",
		"editionBundled": false,
		"homepageUrl": "http://redirect.sonarsource.com/plugins/python.html",
		"issueTrackerUrl": "https://jira.sonarsource.com/browse/SONARPY",
		"implementationBuild": "8241f6a6f0bdd5175741f8b4e302fc6942f2f248",
		"filename": "sonar-python-plugin-3.9.0.9230.jar",
		"hash": "5a604d2b4aa172cc6cfe06b5c6732694",
		"sonarLintSupported": true,
		"documentationPath": "static/documentation.md",
		"updatedAt": 1645664304005
	}, {
		"key": "ruby",
		"name": "Ruby Code Quality and Security",
		"description": "Code Analyzer for Ruby",
		"version": "1.9.0 (build 3429)",
		"license": "GNU LGPL 3",
		"organizationName": "SonarSource",
		"organizationUrl": "http://www.sonarsource.com",
		"editionBundled": false,
		"homepageUrl": "http://redirect.sonarsource.com/plugins/ruby.html",
		"issueTrackerUrl": "https://jira.sonarsource.com/browse/SONARSLANG",
		"implementationBuild": "faf3c08c0ebf3a877186442cd4a0ddd50de079a8",
		"filename": "sonar-ruby-plugin-1.9.0.3429.jar",
		"hash": "abc95b15f07f98e40fd48ef76b9d976b",
		"sonarLintSupported": true,
		"documentationPath": "static/documentation.md",
		"updatedAt": 1645664304005
	}, {
		"key": "sonarscala",
		"name": "Scala Code Quality and Security",
		"description": "Code Analyzer for Scala",
		"version": "1.9.0 (build 3429)",
		"license": "GNU LGPL 3",
		"organizationName": "SonarSource",
		"organizationUrl": "http://www.sonarsource.com",
		"editionBundled": false,
		"homepageUrl": "http://redirect.sonarsource.com/plugins/scala.html",
		"issueTrackerUrl": "https://jira.sonarsource.com/browse/SONARSLANG",
		"implementationBuild": "faf3c08c0ebf3a877186442cd4a0ddd50de079a8",
		"filename": "sonar-scala-plugin-1.9.0.3429.jar",
		"hash": "d19ee4d151a656835fdf77a362ee7f71",
		"sonarLintSupported": true,
		"documentationPath": "static/documentation.md",
		"updatedAt": 1645664304005
	}, {
		"key": "text",
		"name": "Text file Code Quality and Security",
		"description": "Plugin to analyze text files",
		"version": "1.0 (build 120)",
		"license": "GNU LGPL 3",
		"organizationName": "SonarSource",
		"organizationUrl": "https://www.sonarsource.com",
		"editionBundled": false,
		"homepageUrl": "http://docs.sonarqube.org/display/PLUG/Plugin+Library/text/sonar-text-plugin",
		"issueTrackerUrl": "https://github.com/SonarSource/sonar-text/issues",
		"implementationBuild": "b7539037caf5df01cc49bb7820a0c23f35196f0e",
		"filename": "sonar-text-plugin-1.0.0.120.jar",
		"hash": "04f09fd56a839c51a3abce78c01240aa",
		"sonarLintSupported": false,
		"updatedAt": 1645664304005
	}, {
		"key": "vbnet",
		"name": "VB.NET Code Quality and Security",
		"description": "Code Analyzer for VB.NET",
		"version": "8.34 (build 42011)",
		"license": "GNU LGPL 3",
		"organizationName": "SonarSource",
		"organizationUrl": "http://www.sonarsource.com",
		"editionBundled": false,
		"homepageUrl": "http://redirect.sonarsource.com/plugins/vbnet.html",
		"issueTrackerUrl": "https://github.com/SonarSource/sonar-dotnet/issues",
		"implementationBuild": "7e01861b987ff6ebaef0ce378b5d90a3c8012f96",
		"filename": "sonar-vbnet-plugin-8.34.0.42011.jar",
		"hash": "062b338d3ca36a5227288e0349e564ea",
		"sonarLintSupported": false,
		"documentationPath": "static/documentation.md",
		"updatedAt": 1645664304005
	}, {
		"key": "xml",
		"name": "XML Code Quality and Security",
		"description": "Code Analyzer for XML",
		"version": "2.5 (build 3376)",
		"license": "GNU LGPL 3",
		"organizationName": "SonarSource",
		"organizationUrl": "http://www.sonarsource.com",
		"editionBundled": false,
		"homepageUrl": "http://redirect.sonarsource.com/plugins/xml.html",
		"issueTrackerUrl": "https://jira.sonarsource.com/browse/SONARXML",
		"implementationBuild": "3b089c16cf0736c56f4fdb2fc88ddad59e7ca45d",
		"filename": "sonar-xml-plugin-2.5.0.3376.jar",
		"hash": "174d80380d3f6820c8a33f10927fd650",
		"sonarLintSupported": true,
		"documentationPath": "static/documentation.md",
		"updatedAt": 1645664304005
	}]
}

I found the situation of the problem, but I don’t know how to locate it。When I trigger sonarlint: update all project bindings to sonarqube / sonarcloud, the update is successful. At this time, the number of problems displayed is cleared. After about 5 minutes, the number of problems in the analysis file is normal. I don’t know why it’s so slow to take effect.
sonarlint.log (8.2 KB)

I think I’ve located the problem。“All SonarLint bindings succesfully updated” when the following prompt appears,The /Users/luoyong/.sonarlint/storage/736f6e6172/projects/64656d6f/analyzer_config.pb file was not generated。After waiting for the file to be generated, the analysis results are displayed normally。How should I deal with this problem。

This may not be a mistake。I mean, will there be an eye-catching prompt if the analyzer_config.pb file is create successfully,Or what configurations can speed up file generation。

Hi,

The log file you shared doesn’t contain the logs of the “update binding” command. Could you please:

  • clear log output
  • trigger an update of the binding
  • share the log with us

Thank you for your reply.
sonarlint.log (30.2 KB)

Here are some of my statuses:
1、Analysis when not connected

2、Connected but no file generated

3、Connect and generate files

I need to spend a few minutes waiting for 2->3 and constantly execute ls to judge whether the analyzer_config.pb file is generated. Is there any way to speed up or prompt the results

Hi @Mr.l

Thanks for all the details, this is very valuable. I was able to understand the problem and I created a ticket: [SLVSCODE-249] No issues reported about a manual update of the binding - SonarSource
We will fix it during the current sprint.

In the meantime, I suggest you simply avoid using the “Update all project bindings” command. We are progressively moving away from this manual action, so rules and analyzers are automatically updated every hours anyway.

Version 3.4 of SonarLint has been released with the fix for this issue.

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