I have been trying to get Sonarlint working on VS Code. It took a little to get the java and nodejs paths right but they appear to be OK now. However, it doesn’t scan my project files - rather the logs indicate it uses a base directory of:
Startup logs the following:
[stdout] Binding to 40861
Child process connected on port 40861
[Info - 09:34:00.245] Started security hotspot handler on port 64120
Initializing file:///home/myuser/git/correct-project-folder on branch actual_git_branch_name
[Debug - 09:34:01.207] Fetching configuration for folder 'null'
[Debug - 09:34:01.253] Queuing analysis of file 'file:///home/myuser/.vscode-server/data/Machine/settings.json' (version 1)
[Debug - 09:34:01.315] Folder file:///home/myuser/git/correct-project-folder is now on branch actual_git_branch_name.
[Debug - 09:34:01.796] Fetching configuration for folder 'file:///home/myuser/git/correct-project-folder'
[Debug - 09:34:02.021] Cached SCM ignore status for file 'file:///home/myuser/.vscode-server/data/Machine/settings.json'
[Info - 09:34:02.249] Analyzing file 'file:///home/myuser/.vscode-server/data/Machine/settings.json'...
[Debug - 09:34:02.341] Analysis triggered with configuration:
This means it only ever picks up it’s own Settings.js file, leading to log messages like the below:
[Debug - 09:34:13.083] 'TypeScript analysis' skipped because there is no related files in the current project
I haven’t been able to find anywhere I can stipulate how to set that baseDir path outside of that
- Operating system: WSL2 (Ubuntu 20.4 on Windows 10)
- IDE name and flavor/env: VS Code
- SonarLint plugin version: v3.4.1
- Is connected mode used: No
I would really love to make use of this tool - but I can’t seem to get around this roadbump. Any assistance would be greatly appreciated!
Hello @mrcraze and welcome to the community!
I’m trying to reproduce and I’d like to ask couple questions to clarify, if you don’t mind.
- Your local git repo was cloned to WSL file system, right?
- Your java and node.js located on WSL FS or on Windows disk?
- Did you installed VSCode to WSL or to Windows?
- Also can I ask you to show your VSCode settings.json? Without sensitive data, obviously.
Thank you so much for replying and the welcome - and the effort in investigating!
Re your questions:
- Yes, it was cloned in WSL
- Both node and java are on WSL (I had to get them installed/re-installed for sonarlint - sonarlint installed java for me)
- I am not 100% sure - I think I did install vs code on WSL but I do have it also on my Windows side - but I run it from WSL terminal (using “code .”) and it connects in ‘Remote’ mode to the WSL context
My settings.json file is below (but I have experimented with a number of different options - especially passing the baseDir param, also the javaHome is a symlink now - but originally it was “/home/myuser/.vscode-server/extensions/sonarsource.sonarlint_managed-jre/jre/jdk-11.0.15+10-jre/” ):
If there is another settings file please let me know - this is all I can find.
I think it worked once - where it picked up the right path but then went back to the wrong base path right away. Try as I may I can’t get it - if you can provide any insight/reproduce it, that’d be so helpful.
Thanks to all that had a look at this. It seems to have been an issue with VS Code not parsing a file until it was closed and reopened. I stumbled across that somehow - sorry for the ignorance on my part. Thanks again!
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.