Syncing of issue status in release branch to SonarLint

Please provide

  • Operating system: Windows 10
  • SonarLint plugin version: 7.1.1.54565
  • Programming language you’re coding in: C#
  • Is connected mode used:
    • Connected to SonarCloud or SonarQube (and which version): SonarQube 9.6.1.59531

And a thorough description of the problem / question:
New to here and could not find a similar topic, sorry if it has been asked before.

Steps:

Created a feature branch from a release branch of the master1 but did not work on it straight away
Nightly scan raises a S107 issue is in the master branch, release branch
SonarLint reports on the S107 issue in the feature branch

The issue marked as “Won’t fix” in master branch and release branch
Opening the release branch, SonarLint no longer raises the S107 issue
Opening the feature branch, SonarLine still raises the issue.
No changes/commits have been made to the feature branch at this time

→ Have not found a way to get the feature branch to accept the status change on the S107 issue. Thought that this was working correctly but at least for this feature branch it is not syncing. Is there some way to track what is going on?

Tried the following:

Opened the release branch and ran SonarLint analysis on the file in question. SonarLint does not raise the S107 issue.

Created a new feature branch from the release branch and checked it out, ran SonarLint analysis on the file and it raises the S017 issue.

Hi @tjorvi

SonarLint will synchronize issues status with SonarQube, trying to find the best matching branch between your currently checked out branch, and available branches on SonarQube.

Since in your case the “feature” branch is not yet analyzed on SonarQube, this “branch matching” should fallback on the master branch. You can confirm that by enabling verbose logs in the SonarLint logs, and triggering a forced update of the local storage:

In the logs, you should see the calls to SonarQube, with the branch that was used. For example in my case:

GET 200 https://next.sonarqube.com/sonarqube/api/issues/pull?projectKey=org.sonarsource.sonarlint.intellij%3Asonarlint-intellij&branchName=master&languages=web,java,js,kotlin,php,py,ruby,scala,secrets,swift,ts,xml&changedSince=1667469367724 | response time=59ms
Pulled issues in 59ms
Merged 0 issues in store. Closed 0. | took 14ms
[SYNC] Synchronizing taint issues for project 'org.sonarsource.sonarlint.intellij:sonarlint-intellij' on branch 'master'
GET 200 https://next.sonarqube.com/sonarqube/api/issues/pull_taint?projectKey=org.sonarsource.sonarlint.intellij%3Asonarlint-intellij&branchName=master&languages=web,java,js,kotlin,php,py,ruby,scala,secrets,swift,ts,xml&changedSince=1667469367883 | response time=57ms
Pulled taint issues in 57ms

Can you confirm you see branchName=master on your side?

Thanks for the quick reply. We have a master branch called “develop” and I can confirm that it is correct in the URL:

[SYNC] Synchronizing taint issues for project 'SFM_SFM_AYFc14sYIHiAo-uBezV4' on branch 'develop'
GET 200 https://sonarqube.sfm.cloud/sq/api/issues/pull_taint?projectKey=SFM_SFM_AYFc14sYIHiAo-uBezV4&branchName=develop&languages=cs,secrets&changedSince=1667486971836 | response time=31ms
Pulled taint issues in 31ms
Merged 0 taint issues in store. Closed 0. | took 0ms
Skip downloading file taint issues on SonarQube 9.6+
Skip downloading file taint issues on SonarQube 9.6+
Skip downloading file taint issues on SonarQube 9.6+
Skip downloading file taint issues on SonarQube 9.6+
Skip downloading file taint issues on SonarQube 9.6+
Skip downloading file taint issues on SonarQube 9.6+
Skip downloading file taint issues on SonarQube 9.6+
Skip downloading file taint issues on SonarQube 9.6+
Skip downloading file taint issues on SonarQube 9.6+
Skip downloading file taint issues on SonarQube 9.6+
Skip downloading file taint issues on SonarQube 9.6+
Skip downloading file taint issues on SonarQube 9.6+
Skip downloading file taint issues on SonarQube 9.6+
Skip downloading file taint issues on SonarQube 9.6+
Skip downloading file taint issues on SonarQube 9.6+
Skip downloading file taint issues on SonarQube 9.6+
Clearing all issues because binding was updated
Trigger: BINDING_UPDATE
[Binding update] 20 file(s) submitted

But there are some extra messages after the pull.

By chance, do you see messages in logs like:

No VCS repository found for module Module: 'rider.module'

And the first question I should have asked: is your project hosted on Git?

We are using Azure for the repository.
The only reference in my logs to rider.module is

Configuring analysis with org.sonarlint.intellij.rider.RiderAnalysisConfigurator
Using connection 'Thula' for project 'SFM_SFM_AYFc14sYIHiAo-uBezV4'
Analysing 16 files...
Starting analysis with configuration:
[
  projectKey: SFM_SFM_AYFc14sYIHiAo-uBezV4
  baseDir: C:\ATR\Thula\SFM\src
  extraProperties: {sonar.cs.internal.solutionPath=C:\ATR\Thula\SFM\src\SFM.sln, sonar.cs.internal.dotnetCliExeLocation=C:\Program Files\dotnet\dotnet.exe, sonar.cs.internal.msBuildPath=C:\Program Files\dotnet\sdk\6.0.101}
  moduleKey: Module: 'rider.module'
  inputFiles: [

When trying to find the best matching branch on SonarQube, SonarLint will look for the “closest” match. So if you created the feature branch by forking develop, then it is expected that SonarLint will synchronize issue status with it.

Is the issue marked as “Won’t fix” on the develop branch?

It is marked as “Won’t fix” on all branches in SonarQube.
I invalidated all indexes in Rider and reopened Rider and resynced SonarLint. It is now not finding any issues in the file. Rider is still indexing so something might still happen.

Configuring analysis with org.sonarlint.intellij.rider.RiderAnalysisConfigurator
Using connection 'Thula' for project 'SFM_SFM_AYFc14sYIHiAo-uBezV4'
Analysing 'M251Generator.cs'...
Starting analysis with configuration:
[
  projectKey: SFM_SFM_AYFc14sYIHiAo-uBezV4
  baseDir: C:\ATR\Thula\SFM\src
  extraProperties: {sonar.cs.internal.solutionPath=C:\ATR\Thula\SFM\src\SFM.sln, sonar.cs.internal.dotnetCliExeLocation=C:\Program Files\dotnet\dotnet.exe, sonar.cs.internal.msBuildPath=C:\Program Files\dotnet\sdk\6.0.101}
  moduleKey: Module: 'rider.module'
  inputFiles: [
    file:///C:/ATR/Thula/SFM/src/server/SFM.Server.Core/Core/BusinessLogic/MessageHandlers/M251/M251Generator.cs (UTF-8)
  ]
]

Done in 27ms

Processed 0 issues
Found 0 issues

Looks like the analysis is stopping on:

Execute Sensor: OmniSharp
Timeout waiting for the solution to be loaded. You can find help on https://github.com/SonarSource/sonarlint-intellij/wiki/Rider
Done in 14ms

Changes analysis properties to:

image

and the analysis is working again. Also the S107 rule is not being triggered…

Looks like my issue was a combination of the project being too large and corrupt indexes in Rider. Thanks Julien for your help. It saved the day :slight_smile:

1 Like

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