SonarQube for VS - Open in IDE wrong path

Hello,

I’m currently using:

  • Visual Studio version 17.12.1
  • SonarQube for Visual Studio version 8.15.0.12648

I have connected the extension to my project and have run an analysis in devops on a branch - which gave me back some issues in the SonarQube Cloud Portal.

I noticed that there’s an ‘Open in IDE’ button on each issue. Upon clicking that I get a success toast in the bottom left hand corner saying success.

Unfortunately, in my IDE the file & line never opens, but I did notice a banner saying there was an issue with opening the file.

Upon inspection of the logs, it looks like it is expecting my repository to be located directly on the C: drive like so:
‘**C:**MyProjectName\Controllers\FileName.cs’.

In reality it’s under:
‘**C:\Users\MyName\source\repos**MyProjectName\Controllers\FileName.cs’

Is there any way to change this in the extension settings so that it knows the proper path to the solution files? Is there a reason it would assume the repository is located directly on the C: drive?

This is the standard path for all of the developers on my team (except it uses their name respectively), so I can’t just move the repository directly to the C: drive.

Thanks in advance,

Sam

Hi,

Welcome to the community and thanks for reporting this!

Would you mind sharing a log?

 
Thx,
Ann

Hello,

I have changed the names of the folder structure and redacted any keys in the logs for privacy/security reasons.

The logs are attached below:
SonarQube_OpenInIDE_Logs.txt (1.1 KB)

One thing that I noticed is that it’s setting ‘Root: C:\’ at the end of the 3rd logging statement.

Thanks,
Sam

1 Like

Hi Sam,

Thanks for the log. I’ve flagged this for the experts.

 
Ann

Thanks Ann.

I look forward to hearing from the experts on this issue.

Sam

Hi @SamOnePlan

Normally the fact that the root is set to the drive’s root should not matter. We do it for some internal reasons, but all file paths are supposed to be relative to the root (and produce the correct absolute path in combination with said root).

Can you please provide the relative path in SonarQube Cloud project to the file you’re trying to open? I think our server-to-local path translation failed for some reason here.

@SamOnePlan could you also look for Matched paths for config scope in the logs?

Hi Georgii,

Here is what the relative path looks like in SonarQube Cloud:
‘MyProject/Scripts/Apps/Module1/Module.js’

Here is the snippet from the logs for the ‘matched paths for config scope’ that you asked for:

‘09:49:58:644 [DEBUG] [ThreadId 28] [SLCore] [sonarlint > sonarlint-path-translation] Matched paths for config scope ‘MyProject’:
09:49:58:644 * idePrefix=
09:49:58:644 * serverPrefix=
09:49:58:668 [DEBUG] [ThreadId 16] [SLCore] [sonarlint > SonarLint Local Storage Synchronizer] Stored server info’

Seems like path translation did indeed fail :thinking:
idePrefix should normally be equal to the segment of the path between the disk root and the server analysis root

Could you try move your project under a different directory and see if the issue is still there? In the meantime I will try to create a build of the extension with more debug logs to try to understand why it happened