Visual Code - SonarLint - issues on .ts files are not reported anymore VSCode 1.42.1 + SonarLint 1.15.0

I have a folder in VS Code connected with a Sonarqube
On Sonarqube there are a lot of issues on my .ts files, and, on the older version of VS Code and SonaLint, the …ts issues are show on my Problems view.

Don’t remember my old versions, but since I updated VS Code and SonaLint, Problem view do not show issues from .ts files anymore…

Issues from other files (like .html) are shown normally.

Hello, thank you for your feedback.

Could you please check the version of SonarJS installed on your SonarQube instance?

If you set the sonarlint.output.showVerboseLogs setting to true, the versions of analyzers should appear in the SonarLint output at startup, something like this:

[Debug - 09:01:17.296] Load plugins
[Debug - 09:01:17.317] Load plugins (done) | time=22ms
[Debug - 09:01:17.357] Plugins:
[Debug - 09:01:17.357]   * SonarPython 2.5.0.5733 (python)
[Debug - 09:01:17.357]   * SonarJava 6.1.0.20866 (java)
[Debug - 09:01:17.357]   * SonarHTML 3.2.0.2082 (web)
[Debug - 09:01:17.357]   * SonarPHP 3.3.0.5166 (php)
[Debug - 09:01:17.357]   * SonarTS 1.9.0.3766 (typescript)
[Debug - 09:01:17.357]   * SonarJS 5.1.1.7506 (javascript)

In your case, you should have 2 of those blocks: one for the embedded analyzers, and one for the ones that are downloaded from SonarQube.

Note that if your project mixes JS and TS files, recent versions of SonarJS (in the 6.x series) have a known issue.

Hi

SonarJs version on my SonarQube is 6.2 (build 12043)
The SonarQube version itself is 7.9.2 (build 30863)

The sonarlint.output.showVerboseLogs after an “Update all bindings to SonarQube/SonarCloud”

[Debug - 09:05:37.716] Load plugins
[Debug - 09:05:37.720] Load plugins (done) | time=4ms
[Debug - 09:05:37.733] Plugins:
[Debug - 09:05:37.733]   * SonarPython 2.4.0.5513 (python)
[Debug - 09:05:37.733]   * SonarJava 6.0.2.20657 (java)
[Debug - 09:05:37.733]   * SonarHTML 3.2.0.2082 (web)
[Debug - 09:05:37.733]   * SonarPHP 3.3.0.5166 (php)
[Debug - 09:05:37.733]   * SonarTS 2.1.0.4359 (typescript)
[Debug - 09:05:37.733]   * SonarJS 6.2.0.12043 (javascript)
[Info  - 09:05:37.739] Using storage for server 'BLLOG' (last update 3/10/20 9:05 AM)

The sonarlint.output.showVerboseLogs when my project/folder is not linked with a SonarQube

[Debug - 09:08:03.838] Load plugins
[Debug - 09:08:03.850] Load plugins (done) | time=11ms
[Debug - 09:08:03.884] Plugins:
[Debug - 09:08:03.884]   * SonarPython 2.5.0.5733 (python)
[Debug - 09:08:03.884]   * SonarJava 6.1.0.20866 (java)
[Debug - 09:08:03.885]   * SonarHTML 3.2.0.2082 (web)
[Debug - 09:08:03.885]   * SonarPHP 3.3.0.5166 (php)
[Debug - 09:08:03.885]   * SonarTS 1.9.0.3766 (typescript)
[Debug - 09:08:03.886]   * SonarJS 5.1.1.7506 (javascript)

I don’t think the problem is because there are .js and .ts files. The project do not gain new files recently and before the VS Code/ Sonarlint update, the issues from .ts files are shown. And the issues from .ts are still shown on SonarQube.

The problem could be because my SonarTS/SonarJS on SonarQube are newer than the SonarTS/SonarJS on VS Code + SonarLint?

If yes, how may I update then on VS Code + SonarLint?

1 - Just to confirm,

Theses analysis are actually made by Sonarlint itself (based on the “Quality Profiles” downloaded from SonarQube) and not by SonarQube (via request), right?

[Debug - 09:26:41.365] Load plugins
[Debug - 09:26:41.371] Load plugins (done) | time=6ms
[Debug - 09:26:41.384] Plugins:
[Debug - 09:26:41.384]   * SonarPython 2.6.0.5863 (python)
[Debug - 09:26:41.384]   * SonarJava 6.2.0.21135 (java)
[Debug - 09:26:41.384]   * SonarHTML 3.2.0.2082 (web)
[Debug - 09:26:41.384]   * SonarPHP 3.3.0.5166 (php)
[Debug - 09:26:41.384]   * SonarTS 2.1.0.4359 (typescript)
[Debug - 09:26:41.384]   * SonarJS 6.2.0.12043 (javascript)
[Info  - 09:26:41.390] Using storage for server 'BLLOG' (last update 3/10/20 9:26 AM)
[Info  - 09:26:41.450] Global storage status: org.sonarsource.sonarlint.core.container.model.DefaultGlobalStorageStatus@7bce732f
[Debug - 09:26:41.483] GET 200 http://192.168.0.193/api/qualityprofiles/search.protobuf?project=blive-cockpit-front | response time=28ms
[Debug - 09:26:41.483] Downloaded project quality profiles in 28ms
[Debug - 09:26:41.504] GET 200 http://192.168.0.193/api/settings/values.protobuf?component=blive-cockpit-front | response time=20ms
[Info  - 09:26:41.505] Downloaded settings in 21ms
[Debug - 09:26:41.513] GET 200 http://192.168.0.193/api/components/tree.protobuf?qualifiers=BRC&component=blive-cockpit-front&ps=500&p=1 | response time=8ms
[Debug - 09:26:41.513] Page downloaded in 8ms
[Debug - 09:26:41.535] GET 200 http://192.168.0.193/batch/issues?key=blive-cockpit-front | response time=14ms
[Debug - 09:26:41.536] Downloaded issues in 16ms
[Debug - 09:26:41.567] GET 200 http://192.168.0.193/api/components/tree.protobuf?qualifiers=FIL,UTS&component=blive-cockpit-front&ps=500&p=1 | response time=12ms
[Debug - 09:26:41.574] Page downloaded in 19ms
[Debug - 09:26:41.618] GET 200 http://192.168.0.193/api/qualityprofiles/search.protobuf?project=blive-cockpit-front | response time=30ms
[Debug - 09:26:41.618] Downloaded project quality profiles in 30ms
[Debug - 09:26:41.637] GET 200 http://192.168.0.193/api/settings/values.protobuf?component=blive-cockpit-front | response time=19ms
[Info  - 09:26:41.637] Downloaded settings in 19ms
[Debug - 09:26:41.647] GET 200 http://192.168.0.193/api/components/tree.protobuf?qualifiers=BRC&component=blive-cockpit-front&ps=500&p=1 | response time=10ms
[Debug - 09:26:41.647] Page downloaded in 10ms
[Debug - 09:26:41.668] GET 200 http://192.168.0.193/batch/issues?key=blive-cockpit-front | response time=19ms
[Debug - 09:26:41.672] Downloaded issues in 23ms
[Debug - 09:26:41.706] GET 200 http://192.168.0.193/api/components/tree.protobuf?qualifiers=FIL,UTS&component=blive-cockpit-front&ps=500&p=1 | response time=19ms
[Debug - 09:26:41.708] Page downloaded in 21ms
[Debug - 09:26:41.719] Queuing analysis of file 'file:///d%3A/workspaces/workspace-fred/blive-cockpit/Cockpit/frontend/cockpit/src/pages/management/management.html'
[Debug - 09:26:41.719] Queuing analysis of file 'file:///d%3A/workspaces/workspace-fred/blive-cockpit/Cockpit/frontend/cockpit/src/models/geo.ts'
[Debug - 09:26:41.897] Resolved binding ProjectBinding[projectKey=blive-cockpit-front,sqPathPrefix=,idePathPrefix=] for folder d:\workspaces\workspace-fred\blive-cockpit
[Info  - 09:26:41.899] Analyzing file 'file:///d%3A/workspaces/workspace-fred/blive-cockpit/Cockpit/frontend/cockpit/src/pages/management/management.html'...
[Debug - 09:26:41.899] Analysis triggered on 'file:///d%3A/workspaces/workspace-fred/blive-cockpit/Cockpit/frontend/cockpit/src/pages/management/management.html' with configuration: 
[
  projectKey: blive-cockpit-front
  baseDir: d:\workspaces\workspace-fred\blive-cockpit
  extraProperties: {}
  inputFiles: [
    file:///d%3A/workspaces/workspace-fred/blive-cockpit/Cockpit/frontend/cockpit/src/pages/management/management.html (UTF-8) [web]
  ]
]

[Info  - 09:26:42.825] Found 3 issue(s)
[Info  - 09:26:42.826] Analyzing file 'file:///d%3A/workspaces/workspace-fred/blive-cockpit/Cockpit/frontend/cockpit/src/models/geo.ts'...
[Debug - 09:26:42.826] Analysis triggered on 'file:///d%3A/workspaces/workspace-fred/blive-cockpit/Cockpit/frontend/cockpit/src/models/geo.ts' with configuration: 
[
  projectKey: blive-cockpit-front
  baseDir: d:\workspaces\workspace-fred\blive-cockpit
  extraProperties: {}
  inputFiles: [
    file:///d%3A/workspaces/workspace-fred/blive-cockpit/Cockpit/frontend/cockpit/src/models/geo.ts (UTF-8) [ts]
  ]
]

[Info  - 09:26:47.496] Found 0 issue(s)

2 - Is there a way to list the active rules (on sonarlint) after the sync with SonarQube?
(I’m suspecting that because of the difference in SonarJS/SonarTs version, some rules are being ignored by Sonarlint…)

Yes, SonarLint runs analysis locally.

In connected mode, SonarLint will use the same analyzers than the server, so it should not be an issue.

Could you please enable analyzers logs (set sonarlint.output.showAnalyzerLogs setting to true) and reopen a .ts file to see what is happening.

[Info  - 10:34:07.899] Analyzing file 'file:///d%3A/workspaces/workspace-fred/blive-cockpit/Cockpit/frontend/cockpit/src/models/geo.ts'...
[Info  - 10:34:07.903] Index files
[Info  - 10:34:07.904] 1 file indexed
[Info  - 10:34:07.927] Since SonarTS v2.0, TypeScript analysis is performed by SonarJS analyzer v6.0 or later. No TypeScript analysis is performed by SonarTS.
[Info  - 10:34:07.940] Found 0 issue(s)

SonarQube from geo.ts (with 10 issues)

Hello, this seems rather terse.

Could you please try with both sonarlint.output.showAnalyzerLogs and sonarlint.output.showVerboseLogs?

Also, it could be useful to check the logs of the first analysis, i.e to restart or reload your Code window after updating these properties, and re-open your .ts file.

Using

	"sonarlint.trace.server": "verbose",
	"sonarlint.output.showVerboseLogs": true,
	"sonarlint.output.showAnalyzerLogs": true,

After restart Visual Code:

[Info  - 11:12:12.844] Using storage for server 'BLLOG' (last update 3/10/20 9:41 AM)
[Info  - 11:12:13.847] Analyzing file 'file:///d%3A/workspaces/workspace-fred/blive-cockpit/Cockpit/frontend/cockpit/src/models/geo.ts'...
[Info  - 11:12:13.936] Index files
[Info  - 11:12:13.941] 1 file indexed
[Info  - 11:12:15.109] Since SonarTS v2.0, TypeScript analysis is performed by SonarJS analyzer v6.0 or later. No TypeScript analysis is performed by SonarTS.
[Info  - 11:12:19.166] Using TypeScript at: 'c:\Program Files\Microsoft VS Code\resources\app\extensions\node_modules'
[Error - 11:12:19.208] Only Node.js v8 or later is supported, got v7.10.1.
[Error - 11:12:19.209] org.sonarsource.nodejs.NodeCommandException: Only Node.js v8 or later is supported, got v7.10.1.
	at org.sonarsource.nodejs.NodeCommandBuilderImpl.checkNodeCompatibility(NodeCommandBuilderImpl.java:172)
	at org.sonarsource.nodejs.NodeCommandBuilderImpl.build(NodeCommandBuilderImpl.java:144)
	at org.sonar.plugins.javascript.eslint.EslintBridgeServerImpl.initNodeCommand(EslintBridgeServerImpl.java:148)
	at org.sonar.plugins.javascript.eslint.EslintBridgeServerImpl.startServer(EslintBridgeServerImpl.java:106)
	at org.sonar.plugins.javascript.eslint.EslintBridgeServerImpl.startServerLazily(EslintBridgeServerImpl.java:168)
	at org.sonar.plugins.javascript.eslint.AbstractEslintSensor.execute(AbstractEslintSensor.java:106)
	at org.sonar.plugins.javascript.eslint.TypeScriptSensor.execute(TypeScriptSensor.java:53)
	at org.sonarsource.sonarlint.core.analyzer.sensor.SensorsExecutor.executeSensor(SensorsExecutor.java:80)
	at org.sonarsource.sonarlint.core.analyzer.sensor.SensorsExecutor.execute(SensorsExecutor.java:71)
	at org.sonarsource.sonarlint.core.container.analysis.AnalysisContainer.doAfterStart(AnalysisContainer.java:134)
	at org.sonarsource.sonarlint.core.container.ComponentContainer.startComponents(ComponentContainer.java:125)
	at org.sonarsource.sonarlint.core.container.ComponentContainer.execute(ComponentContainer.java:110)
	at org.sonarsource.sonarlint.core.container.storage.StorageAnalyzer.analyze(StorageAnalyzer.java:75)
	at org.sonarsource.sonarlint.core.container.storage.StorageContainerHandler.analyze(StorageContainerHandler.java:81)
	at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.lambda$analyze$0(ConnectedSonarLintEngineImpl.java:152)
	at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.withReadLock(ConnectedSonarLintEngineImpl.java:344)
	at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.withReadLock(ConnectedSonarLintEngineImpl.java:334)
	at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.analyze(ConnectedSonarLintEngineImpl.java:149)
	at org.sonarsource.sonarlint.ls.AnalysisManager.lambda$analyzeConnected$7(AnalysisManager.java:336)
	at org.sonarsource.sonarlint.ls.AnalysisManager.analyzeWithTiming(AnalysisManager.java:352)
	at org.sonarsource.sonarlint.ls.AnalysisManager.analyzeConnected(AnalysisManager.java:336)
	at org.sonarsource.sonarlint.ls.AnalysisManager.analyze(AnalysisManager.java:243)
	at org.sonarsource.sonarlint.ls.AnalysisManager.lambda$analyzeAsync$0(AnalysisManager.java:205)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

[Info  - 11:12:19.218] Found 0 issue(s)

Seems like the problem is my old Nodes version (needed for another specific project…).

I Installed the version 8 and… it worked…

[Info  - 11:19:05.298] Using storage for server 'BLLOG' (last update 3/10/20 9:41 AM)
[Info  - 11:19:07.058] Analyzing file 'file:///d%3A/workspaces/workspace-fred/blive-cockpit/Cockpit/frontend/cockpit/src/models/geo.ts'...
[Info  - 11:19:07.170] Index files
[Info  - 11:19:07.178] 1 file indexed
[Info  - 11:19:08.503] Since SonarTS v2.0, TypeScript analysis is performed by SonarJS analyzer v6.0 or later. No TypeScript analysis is performed by SonarTS.
[Info  - 11:19:14.942] Using TypeScript at: 'c:\Program Files\Microsoft VS Code\resources\app\extensions\node_modules'
[Info  - 11:19:17.164] Found 1 tsconfig.json file(s): [d:\workspaces\workspace-fred\blive-cockpit\Cockpit\frontend\cockpit\tsconfig.json]
[Info  - 11:19:17.319] 1 source files to be analyzed
[Info  - 11:19:17.320] Analyzing 1 files using tsconfig: d:\workspaces\workspace-fred\blive-cockpit\Cockpit\frontend\cockpit\tsconfig.json
[Warn  - 11:19:17.333] You are using version of TypeScript 3.8.3 which is not officially supported; supported versions >=3.2.1 <3.8.0
[Info  - 11:19:18.993] 1/1 source files have been analyzed
[Info  - 11:19:19.133] Found 10 issue(s)

This kind of problem should be shown to the user in a more direct/clear way…

Thank you for coming back with the solution!

A frequent issue with this kind of log messages is that they can quickly become invasive and noisy, which kind of defeats their purpose as troubleshooting tools. And here, I agree that we could provide a more actionable feedback to end users - ticket created!

1 Like