Synchronising new code definition with the server

Hi,

I’m connected to a corporate sonarqube server.

I have updated the new code defintion on my project to be reference_branch(main). I have validated through the sonarqube API that this gets returned from the server with my current project and branch name.

I am trying to use sonarqube locally in my vscode devcontainer. The setup and server connection all work fine. Unfortunately the new code definition part does not. I can see in the logs that a new_code_definition.pb file is written to the disk, but it says “not_provided”

I tried to override this by setting:

"sonarlint.ls.vmargs": "-Dsonar.newCode.referenceBranch=main"

in the devcontainer settings, and this actually works when the devcontainer initially loads, but after a few minutes, some kind of server synchronisation happens, and the new code definition goes to some fallback.

Ideally I don’t want to override vm args at all, I have multiple projects and I would prefer if sonarqube for IDE would fetch properly the new_code_definition for all of them from the server.

Any ideas why this synchronisation might be failing, or what I can do to investigate or overcome this?

For clarity, if there is a way to override the new code definition with vmargs in a way that does not get overridden, then that would be an acceptable solution, but syncing properly with the server state would be preferred.

Hi @peter-lyon1_LSEG,

The New Code definition based on the Reference Branch is not available in any of the IDE plug-ins (see the VSCode Docs for reference). You can only use one of the other New Code definitions, see the documentation link as well.

Even setting any argument for the Language Server won’t enable it or change it.

Cheers :baby_bottle: