- Operating system: Ubuntu 20.04.6 LTS
- Visual Studio Code version: 1.85.2
- SonarLint plugin version: 4.2.2
- Programming language you’re coding in: Python
- Is connected mode used: NO
Hello, I started using Sonarlint VS Code extension, and it worked fine in the beginning. After I refactored my code, so there was no problems displayed, I started write new, after a while I realized that Sonarlint stopped to show problems. I restarted VS Code, I restarted computer, but it didn’t help (in case should I manipulate sysctl properties)
Well, in logs it shows “problem” which should be displayed in Problems section of the VS Code, but throws an exception.
Logs:
Executing /usr/lib/jvm/java-17-openjdk-amd64/bin/java -jar /home/${HOME_DIR}/.vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-linux-x64/server/sonarlint-ls.jar -stdio -analyzers /home/${HOME_DIR}/.vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-linux-x64/analyzers/sonargo.jar /home/${HOME_DIR}/.vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-linux-x64/analyzers/sonarjava.jar /home/${HOME_DIR}/.vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-linux-x64/analyzers/sonarjs.jar /home/${HOME_DIR}/.vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-linux-x64/analyzers/sonarphp.jar /home/${HOME_DIR}/.vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-linux-x64/analyzers/sonarpython.jar /home/${HOME_DIR}/.vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-linux-x64/analyzers/sonarhtml.jar /home/${HOME_DIR}/.vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-linux-x64/analyzers/sonarxml.jar /home/${HOME_DIR}/.vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-linux-x64/analyzers/sonarcfamily.jar /home/${HOME_DIR}/.vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-linux-x64/analyzers/sonartext.jar /home/${HOME_DIR}/.vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-linux-x64/analyzers/sonariac.jar /home/${HOME_DIR}/.vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-linux-x64/analyzers/sonarlintomnisharp.jar
[stderr] SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
[stderr] SLF4J: Defaulting to no-operation (NOP) logger implementation
[stderr] SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[Debug - 11:28:47.045] Fetching global configuration
[Debug - 11:28:47.061] Queuing analysis of file "file:///home/${HOME_DIR}/Projects/${parent-dir}/${current-dir}/functions.py" (version 1)
[Error - 11:28:47.067] Unable to check if file file:///home/${HOME_DIR}/Projects/${parent-dir}/${current-dir}/functions.py is SCM ignored org.eclipse.lsp4j.jsonrpc.ResponseErrorException: Request sonarlint/isIgnoredByScm failed with message: Extension 'vscode.git' is not known or not activated
[Debug - 11:28:47.067] Cached SCM ignore status for file "file:///home/${HOME_DIR}/Projects/${parent-dir}/${current-dir}/functions.py": Unknown
Folder file:///home/${HOME_DIR}/Projects/${parent-dir}/${current-dir} is now on branch 3.6.10
[Debug - 11:28:47.255] Folder file:///home/${HOME_DIR}/Projects/${parent-dir}/${current-dir} is now on branch 3.6.10.
Initializing file:///home/${HOME_DIR}/Projects/${parent-dir}/${current-dir} on branch 3.6.10
[Debug - 11:28:47.283] Folder file:///home/${HOME_DIR}/Projects/${parent-dir}/${current-dir} is now on branch 3.6.10.
[Debug - 11:28:48.028] Fetching configuration for folder 'file:///home/${HOME_DIR}/Projects/${parent-dir}/${current-dir}'
[Debug - 11:28:48.031] Workspace folder 'WorkspaceFolder[name=${current-dir},uri=file:///home/${HOME_DIR}/Projects/${parent-dir}/${current-dir}]' configuration updated: WorkspaceFolderSettings[analyzerProperties={sonar.cs.file.suffixes=.cs, sonar.cs.internal.useNet6=true, sonar.cs.internal.loadProjectOnDemand=false, sonar.cs.internal.loadProjectsTimeout=60},connectionId=<null>,pathToCompileCommands=,projectKey=<null>,testFilePattern=]
[Info - 11:28:48.031] Analyzing file "file:///home/${HOME_DIR}/Projects/${parent-dir}/${current-dir}/functions.py"...
[Debug - 11:28:48.031] Global settings updated: WorkspaceSettings[connections={},disableTelemetry=false,excludedRules=[],focusOnNewCode=false,includedRules=[],pathToNodeExecutable=,ruleParameters={},showAnalyzerLogs=true,showVerboseLogs=true]
[Debug - 11:28:48.035] Default settings updated: WorkspaceFolderSettings[analyzerProperties={sonar.cs.file.suffixes=.cs, sonar.cs.internal.useNet6=true, sonar.cs.internal.loadProjectOnDemand=false, sonar.cs.internal.loadProjectsTimeout=60},connectionId=<null>,pathToCompileCommands=,projectKey=<null>,testFilePattern=]
[Debug - 11:28:48.038] Analysis triggered with configuration:
[
baseDir: /home/${HOME_DIR}/Projects/${parent-dir}/${current-dir}
extraProperties: {sonar.cs.file.suffixes=.cs, sonar.cs.internal.loadProjectsTimeout=60, sonar.cfamily.compile-commands=, sonar.cs.internal.useNet6=true, sonar.cs.internal.loadProjectOnDemand=false}
moduleKey: file:///home/${HOME_DIR}/Projects/${parent-dir}/${current-dir}
excludedRules: []
includedRules: []
ruleParameters: {}
inputFiles: [
file:///home/${HOME_DIR}/Projects/${parent-dir}/${current-dir}/functions.py (UTF-8) [py]
]
]
[Debug - 11:28:48.039] Starting standalone SonarLint engine...
[Debug - 11:28:48.039] Using 11 analyzers
[Debug - 11:28:48.085] Plugin 'JavaScript/TypeScript/CSS Code Quality and Security' requires Node.js 14.17.0. Skip loading it.
[Debug - 11:28:48.088] Loaded 10 plugins
[Debug - 11:28:48.089] * Python Code Quality and Security 4.14.0.14263 (python)
[Debug - 11:28:48.089] * CFamily Code Quality and Security 6.51.0.65468 (cpp)
[Debug - 11:28:48.089] * C# Code Quality and Security (Omnisharp) 1.17.0.82356 (csharp)
[Debug - 11:28:48.089] * Java Code Quality and Security 7.29.0.34131 (java)
[Debug - 11:28:48.089] * HTML Code Quality and Security 3.9.0.3600 (web)
[Debug - 11:28:48.090] * XML Code Quality and Security 2.10.0.4108 (xml)
[Debug - 11:28:48.090] * Go Code Quality and Security 1.15.0.4655 (go)
[Debug - 11:28:48.090] * PHP Code Quality and Security 3.33.0.11274 (php)
[Debug - 11:28:48.090] * IaC Code Quality and Security 1.23.0.7263 (iac)
[Debug - 11:28:48.090] * Text Code Quality and Security 2.7.1.1388 (text)
[Debug - 11:28:49.935] Creating container for module 'file:///home/${HOME_DIR}/Projects/${parent-dir}/${current-dir}'
[Debug - 11:28:49.949] Standalone SonarLint engine started
[Debug - 11:28:50.000] Start analysis
[Info - 11:28:50.014] Index files
[Debug - 11:28:50.016] Language of file "file:///home/${HOME_DIR}/Projects/${parent-dir}/${current-dir}/functions.py" is set to "Python"
[Info - 11:28:50.017] 1 file indexed
[Debug - 11:28:50.348] 'JavaSensor' skipped because there is no related files in the current project
[Debug - 11:28:50.348] Execute Sensor: Python Sensor
[Warn - 11:28:50.350] No workDir in SonarLint
[Debug - 11:28:50.363] Language of file "file:///home/${HOME_DIR}/Projects/${parent-dir}/${current-dir}/intro/functions.py" is detected to be "Python"
[Debug - 11:28:50.363] Language of file "file:///home/${HOME_DIR}/Projects/${parent-dir}/${current-dir}/functions.py" is detected to be "Python"
[Debug - 11:28:50.365] Initializing metadata of file file:///home/${HOME_DIR}/Projects/${parent-dir}/${current-dir}/intro/functions.py
[Debug - 11:28:50.367] Initializing metadata of file file:///home/${HOME_DIR}/Projects/${parent-dir}/${current-dir}/functions.py
[Debug - 11:28:50.372] Input files for indexing: [[uri=file:///home/${HOME_DIR}/Projects/${parent-dir}/${current-dir}/intro/functions.py], [uri=file:///home/${HOME_DIR}/Projects/${parent-dir}/${current-dir}/functions.py]]
[Info - 11:28:50.373] Starting global symbols computation
[Info - 11:28:50.377] 2 source files to be analyzed
[Debug - 11:28:50.526] Symbol _Never has conflicting fully qualified names:typing_extensions.Never,typing.Never
[Debug - 11:28:50.527] It has been disambiguated with its latest Python version available symbol.
[Debug - 11:28:50.558] Unable to construct project-level symbol table for file: [uri=file:///home/${HOME_DIR}/Projects/${parent-dir}/${current-dir}/functions.py]
[Debug - 11:28:50.558] Parse error at line 217 column 8:
213: ) in ("exit", "quit", "q"):
214: return [], []
215: else:
216: print("Provided data is incorrect!")
--> else:
218:
219:
220: rps_values.extend(input_values)
221: return input_values, interval
222:
223:
224: def explore_state(data_array: IntList) -> None:
225:
[Info - 11:28:50.563] 2/2 source files have been analyzed
[Info - 11:28:50.563] Starting rules execution
[Info - 11:28:50.563] 1 source file to be analyzed
[Error - 11:28:50.574] Unable to parse file: [uri=file:///home/${HOME_DIR}/Projects/${parent-dir}/${current-dir}/functions.py]
[Error - 11:28:50.574] Parse error at line 217 column 8:
213: ) in ("exit", "quit", "q"):
214: return [], []
215: else:
216: print("Provided data is incorrect!")
--> else:
218:
219:
220: rps_values.extend(input_values)
221: return input_values, interval
222:
223:
224: def explore_state(data_array: IntList) -> None:
225:
[Debug - 11:28:50.575] Initializing metadata of file file:///home/${HOME_DIR}/Projects/${parent-dir}/${current-dir}/functions.py
[Info - 11:28:50.616] 1/1 source file has been analyzed
[Info - 11:28:50.616] The Python analyzer was able to leverage cached data from previous analyses for 0 out of 1 files. These files were not parsed.
[Debug - 11:28:50.616] 'IPython Notebooks Sensor' skipped because there is no related files in the current project
[Debug - 11:28:50.616] 'OmniSharp' skipped because there is no related files in the current project
[Debug - 11:28:50.616] Execute Sensor: HTML
[Debug - 11:28:50.618] 'XML Sensor' skipped because there is no related files in the current project
[Debug - 11:28:50.618] 'Code Quality and Security for Go' skipped because there is no related files in the current project
[Debug - 11:28:50.618] 'PHP sensor' skipped because there is no related files in the current project
[Debug - 11:28:50.618] 'Analyzer for "php.ini" files' skipped because there is no related files in the current project
[Debug - 11:28:50.618] 'IaC Terraform Sensor' skipped because there is no related files in the current project
[Debug - 11:28:50.618] 'IaC CloudFormation Sensor' skipped because there is no related files in the current project
[Debug - 11:28:50.618] 'IaC Kubernetes Sensor' skipped because there is no related files in the current project
[Debug - 11:28:50.618] 'IaC AzureResourceManager Sensor' skipped because there is no related files in the current project
[Debug - 11:28:50.619] Execute Sensor: TextAndSecretsSensor
[Info - 11:28:50.855] 1 source file to be analyzed
[Info - 11:28:50.905] 1/1 source file has been analyzed
[Debug - 11:28:50.905] Execute Sensor: IaC Docker Sensor
[Info - 11:28:50.907] 0 source files to be analyzed
[Info - 11:28:50.948] 0/0 source files have been analyzed
[Debug - 11:28:50.949] 'CFamily' skipped because there is no related files in the current project
Here it is, the second else was made by purpose to emulate a problem (I checked other problems with Pylint)
So, it identifies the problem, but throws an Exception, and does not display it in Problems section of VS Code.
Also, I would ask, how should I set up workDir? As there is warn.
UPDATE: And re-installation of the plugin didn’t help either
Logs with Exception (without “Show Analyzer’s logs in the Sonarlint output” — option is disabled, and there is an exception). Is exception is the way Sonar handles occurrence of bad code?
Executing /home/${HOME_DIR}/.vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-linux-x64/jre/21.0.1-linux-x86_64.tar/bin/java -jar /home/${HOME_DIR}/.vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-linux-x64/server/sonarlint-ls.jar -stdio -analyzers /home/${HOME_DIR}/.vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-linux-x64/analyzers/sonargo.jar /home/${HOME_DIR}/.vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-linux-x64/analyzers/sonarjava.jar /home/${HOME_DIR}/.vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-linux-x64/analyzers/sonarjs.jar /home/${HOME_DIR}/.vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-linux-x64/analyzers/sonarphp.jar /home/${HOME_DIR}/.vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-linux-x64/analyzers/sonarpython.jar /home/${HOME_DIR}/.vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-linux-x64/analyzers/sonarhtml.jar /home/${HOME_DIR}/.vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-linux-x64/analyzers/sonarxml.jar /home/${HOME_DIR}/.vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-linux-x64/analyzers/sonarcfamily.jar /home/${HOME_DIR}/.vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-linux-x64/analyzers/sonartext.jar /home/${HOME_DIR}/.vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-linux-x64/analyzers/sonariac.jar /home/${HOME_DIR}/.vscode/extensions/sonarsource.sonarlint-vscode-4.2.2-linux-x64/analyzers/sonarlintomnisharp.jar
[stderr] SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
[stderr] SLF4J: Defaulting to no-operation (NOP) logger implementation
[stderr] SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[Debug - 16:45:05.151] Fetching global configuration
Folder file:///home/${HOME_DIR}/Projects/${parent-dir}/${current-dir} is now on branch 3.6.10
Initializing file:///home/${HOME_DIR}/Projects/${parent-dir}/${current-dir} on branch 3.6.10
[Debug - 16:45:05.329] Folder file:///home/${HOME_DIR}/Projects/${parent-dir}/${current-dir} is now on branch 3.6.10.
[Debug - 16:45:05.330] Folder file:///home/${HOME_DIR}/Projects/${parent-dir}/${current-dir} is now on branch 3.6.10.
[Debug - 16:45:06.272] Fetching configuration for folder 'file:///home/${HOME_DIR}/Projects/${parent-dir}/${current-dir}'
[Debug - 16:45:06.275] Workspace folder 'WorkspaceFolder[name=${current-dir},uri=file:///home/${HOME_DIR}/Projects/${parent-dir}/${current-dir}]' configuration updated: WorkspaceFolderSettings[analyzerProperties={sonar.cs.file.suffixes=.cs, sonar.cs.internal.useNet6=true, sonar.cs.internal.loadProjectOnDemand=false, sonar.cs.internal.loadProjectsTimeout=60},connectionId=<null>,pathToCompileCommands=,projectKey=<null>,testFilePattern=]
[Debug - 16:45:06.276] Global settings updated: WorkspaceSettings[connections={},disableTelemetry=false,excludedRules=[],focusOnNewCode=false,includedRules=[],pathToNodeExecutable=,ruleParameters={},showAnalyzerLogs=false,showVerboseLogs=true]
[Debug - 16:45:06.281] Default settings updated: WorkspaceFolderSettings[analyzerProperties={sonar.cs.file.suffixes=.cs, sonar.cs.internal.useNet6=true, sonar.cs.internal.loadProjectOnDemand=false, sonar.cs.internal.loadProjectsTimeout=60},connectionId=<null>,pathToCompileCommands=,projectKey=<null>,testFilePattern=]
[Debug - 16:45:19.875] Queuing analysis of file "file:///home/${HOME_DIR}/Projects/${parent-dir}/${current-dir}/functions.py" (version 1)
No submodules found in '/home/${HOME_DIR}/Projects/${parent-dir}' repository. Error:
Error when detecting ignored files:
[Debug - 16:45:19.888] Cached SCM ignore status for file "file:///home/${HOME_DIR}/Projects/${parent-dir}/${current-dir}/functions.py": Not ignored
[Info - 16:45:19.893] Analyzing file "file:///home/${HOME_DIR}/Projects/${parent-dir}/${current-dir}/functions.py"...
[Debug - 16:45:19.897] Analysis triggered with configuration:
[
baseDir: /home/${HOME_DIR}/Projects/${parent-dir}/${current-dir}
extraProperties: {sonar.cs.file.suffixes=.cs, sonar.cs.internal.loadProjectsTimeout=60, sonar.cfamily.compile-commands=, sonar.cs.internal.useNet6=true, sonar.cs.internal.loadProjectOnDemand=false}
moduleKey: file:///home/${HOME_DIR}/Projects/${parent-dir}/${current-dir}
excludedRules: []
includedRules: []
ruleParameters: {}
inputFiles: [
file:///home/${HOME_DIR}/Projects/${parent-dir}/${current-dir}/functions.py (UTF-8) [py]
]
]
[Debug - 16:45:19.897] Starting standalone SonarLint engine...
[Debug - 16:45:19.897] Using 11 analyzers
[Debug - 16:45:19.929] Plugin 'JavaScript/TypeScript/CSS Code Quality and Security' requires Node.js 14.17.0. Skip loading it.
[Debug - 16:45:19.931] Loaded 10 plugins
[Debug - 16:45:19.931] * Python Code Quality and Security 4.14.0.14263 (python)
[Debug - 16:45:19.931] * CFamily Code Quality and Security 6.51.0.65468 (cpp)
[Debug - 16:45:19.932] * C# Code Quality and Security (Omnisharp) 1.17.0.82356 (csharp)
[Debug - 16:45:19.932] * Java Code Quality and Security 7.29.0.34131 (java)
[Debug - 16:45:19.932] * HTML Code Quality and Security 3.9.0.3600 (web)
[Debug - 16:45:19.932] * XML Code Quality and Security 2.10.0.4108 (xml)
[Debug - 16:45:19.932] * Go Code Quality and Security 1.15.0.4655 (go)
[Debug - 16:45:19.932] * PHP Code Quality and Security 3.33.0.11274 (php)
[Debug - 16:45:19.932] * IaC Code Quality and Security 1.23.0.7263 (iac)
[Debug - 16:45:19.932] * Text Code Quality and Security 2.7.1.1388 (text)
[Debug - 16:45:21.427] Creating container for module 'file:///home/${HOME_DIR}/Projects/${parent-dir}/${current-dir}'
[Debug - 16:45:21.453] Standalone SonarLint engine started
[Debug - 16:45:24.601] Language of file "file:///home/${HOME_DIR}/Projects/${parent-dir}/${current-dir}/functions.py" is detected to be "Python"
[Debug - 16:45:24.602] Failed to remove file "functions.py" from project-level symbol table (file not indexed)
[Error - 16:45:24.610] Error processing file event
[Error - 16:45:24.611] com.sonar.sslr.api.RecognitionException: Parse error at line 217 column 8:
213: ) in ("exit", "quit", "q"):
214: return [], []
215: else:
216: print("Provided data is incorrect!")
--> else:
218:
219:
220: rps_values.extend(input_values)
221: return input_values, interval
222:
223:
224: def explore_state(data_array: IntList) -> None:
225:
at org.sonar.sslr.internal.vm.Machine.parse(Machine.java:73)
at com.sonar.sslr.impl.Parser.parse(Parser.java:84)
at org.sonar.python.parser.PythonParser$SslrPythonParser.parse(PythonParser.java:91)
at org.sonar.python.parser.PythonParser.parse(PythonParser.java:56)
at org.sonar.plugins.python.indexer.PythonIndexer.addFile(PythonIndexer.java:75)
at org.sonar.plugins.python.indexer.SonarLintPythonIndexer.addFile(SonarLintPythonIndexer.java:112)
at org.sonar.plugins.python.indexer.SonarLintPythonIndexer.process(SonarLintPythonIndexer.java:136)
at org.sonarsource.sonarlint.core.analysis.container.module.ModuleFileEventNotifier.tryFireModuleFileEvent(ModuleFileEventNotifier.java:47)
at org.sonarsource.sonarlint.core.analysis.container.module.ModuleFileEventNotifier.lambda$fireModuleFileEvent$0(ModuleFileEventNotifier.java:42)
at java.base/java.util.ArrayList.forEach(Unknown Source)
at org.sonarsource.sonarlint.core.analysis.container.module.ModuleFileEventNotifier.fireModuleFileEvent(ModuleFileEventNotifier.java:42)
at org.sonarsource.sonarlint.core.analysis.command.NotifyModuleEventCommand.execute(NotifyModuleEventCommand.java:40)
at org.sonarsource.sonarlint.core.analysis.command.NotifyModuleEventCommand.execute(NotifyModuleEventCommand.java:27)
at org.sonarsource.sonarlint.core.analysis.AnalysisEngine$AsyncCommand.execute(AnalysisEngine.java:153)
at org.sonarsource.sonarlint.core.analysis.AnalysisEngine.executeQueuedCommands(AnalysisEngine.java:71)
at java.base/java.lang.Thread.run(Unknown Source)
[Debug - 16:45:25.752] Queuing analysis of file "file:///home/${HOME_DIR}/Projects/${parent-dir}/${current-dir}/functions.py" (version 2)
[Info - 16:45:25.754] Analyzing file "file:///home/${HOME_DIR}/Projects/${parent-dir}/${current-dir}/functions.py"...
[Debug - 16:45:25.755] Analysis triggered with configuration:
[
baseDir: /home/${HOME_DIR}/Projects/${parent-dir}/${current-dir}
extraProperties: {sonar.cs.file.suffixes=.cs, sonar.cs.internal.loadProjectsTimeout=60, sonar.cfamily.compile-commands=, sonar.cs.internal.useNet6=true, sonar.cs.internal.loadProjectOnDemand=false}
moduleKey: file:///home/${HOME_DIR}/Projects/${parent-dir}/${current-dir}
excludedRules: []
includedRules: []
ruleParameters: {}
inputFiles: [
file:///home/${HOME_DIR}/Projects/${parent-dir}/${current-dir}/functions.py (UTF-8) [py]
]
]