Connected mode analysis always synchronizes with master

I am using v3.22.0 of the SonarLint extension for VSCode on Windows 10. It always syncs to master, not the git branch I’m actually on. How can I troubleshoot this?

Hello, welcome to the community! And thanks for your question.

Usually, one of the first steps when troubleshooting connected mode in SonarLint for VScode is to enable verbose logging. When this is on, the “SonarLint Output” should log a few messages related to branch management, e.g:

Initializing file:///some/path/to/folder on branch main
[Debug - 11:54:05.209] Fetching global configuration
[Debug - 11:54:05.211] Folder file:///some/path/to/folder is now on branch main.
[Info  - 11:54:12.017] [SYNC] Synchronizing project branches for project 'my-project'
[Debug - 11:54:12.041] GET 200 http://some.server/api/project_branches/list.protobuf?project=my-project | response time=23ms
[Debug - 11:54:12.048] Storing project branches in /home/user/.sonarlint/storage/xxxx/projects/yyyy/project_branches.pb
[Info  - 11:54:12.086] [SYNC] Synchronizing issues for project 'my-project' on branch 'main'

Which branches are analyzed on your server? Also, which server product are you using?

Please note that branch analysis is only available on SonarCloud and with commercial editions of SonarQube.

You should be able to get the full list of analyzed branches for your project at http(s)://<your.server.url>/api/project_branches/list?project=<your-project-key>.

1 Like