SonarLint for VS Code does not show the hits in problems view when custom rules are used

Hi,

SonarLint for Visual studio code is working fine when the hits in source code are related to standard SonarQube rules.
List of hits is well displayed in VS Code’s problem view.

When hits for a custom SonarQube rule are found in the same source code, the hits (for standard and custom rules) are not displayed in VS Code’s problem view.

Could you have a look ?
I saw there was a similar issue in IntelliJ (SonarLint doesn't show custom rules from local SonarQube server)

Thanks
Sebastien

SonarQube Version 7.9.1 (build 27448)
Visual Studio Code Version 1.46.1
SonarLint 1.17.0

Hello, thank you for reporting this.

I did not manage to reproduce this issue: with SonarQube 7.9.1, issues from both a custom rule plugin (for Java) and from SonarQube’s base rules do appear.

I did notice a similar behavior though: when the custom rule was activated with the “Info” severity in the SonarQube quality profile, it did not appear in the “Problems” view and was not fully highlighted in the editor pane. This is due to the mapping done between SonarQube severity and VSCode diagnostic severity:

  • Blocker and Critical are reported as Error
  • Major is reported as Warning
  • Minor is reported as Info
  • Info is reported as Hint

Due to this mapping, issues that have the “Info” SonarQube severity won’t be shown by VSCode in the “Problems” view.

I suggest that you have a look at the activation severity of your custom rules in SonarQube and make sure that they are activated at least at the “Minor” level, then synchronize your binding and try again.

If this does not solve the problem, I suggest that you enable sonarlint.output.showAnalyzerLogs and sonarlint.output.showVerboseLogs properties, and check the SonarLint output pane for exceptions or error messages.

Thank you, I will check. Just to precise, when source does not respect a custom rule, all the issues are not displayed in problems view.

Our custom rules are major or critical.

So, I precise after some tests.
Errors linked to custom rules are never displayed.
In most of the cases standard rules are displayed.

I enabled traces as suggested but there is no error in output pane.
Here are the traces.
What is strange is that log indicates 47 errors and only 40 are visible.
In major I have 22 erros and only 20 are displayed because of the 2 related to custom rule that are missing.

[Debug - 16:56:35.916] File 'file:///v:/VBO_DEV/Preproduction/Release0/Current/ADHOC/PACKAGES/pkg_lcm_recursive.sql' closed. Cleaning diagnostics
[Debug - 16:56:37.734] Queuing analysis of file 'file:///v:/VBO_DEV/Preproduction/Release0/Current/ADHOC/PACKAGES/pkg_lcm_recursive.sql'
[Info  - 16:56:37.735] Analyzing file 'file:///v:/VBO_DEV/Preproduction/Release0/Current/ADHOC/PACKAGES/pkg_lcm_recursive.sql'...
[Debug - 16:56:37.735] Analysis triggered on 'file:///v:/VBO_DEV/Preproduction/Release0/Current/ADHOC/PACKAGES/pkg_lcm_recursive.sql' with configuration: 
[
  projectKey: VSC
  baseDir: v:\VBO_DEV\Preproduction\Release0\Current\ADHOC\PACKAGES
  extraProperties: {}
  inputFiles: [
    file:///v:/VBO_DEV/Preproduction/Release0/Current/ADHOC/PACKAGES/pkg_lcm_recursive.sql (UTF-8) [plsql]
  ]
]
[Debug - 16:56:37.738] Available languages:
[Debug - 16:56:37.738]   * Python => "py"
[Debug - 16:56:37.738]   * HTML => "web"
[Debug - 16:56:37.739]   * JSP => "jsp"
[Debug - 16:56:37.739]   * PHP => "php"
[Debug - 16:56:37.739]   * TypeScript => "ts"
[Debug - 16:56:37.739]   * JavaScript => "js"
[Debug - 16:56:37.739]   * PL/SQL => "plsql"
[Debug - 16:56:37.739] Start analysis
[Debug - 16:56:37.739] Declared extensions of language Python were converted to py: **/*.py
[Debug - 16:56:37.739] Declared extensions of language HTML were converted to web: **/*.html,**/*.xhtml,**/*.cshtml,**/*.vbhtml,**/*.aspx,**/*.ascx,**/*.rhtml,**/*.erb,**/*.shtm,**/*.shtml
[Debug - 16:56:37.740] Declared extensions of language JSP were converted to jsp: **/*.jsp,**/*.jspf,**/*.jspx
[Debug - 16:56:37.740] Declared extensions of language PHP were converted to php: **/*.php,**/*.php3,**/*.php4,**/*.php5,**/*.phtml,**/*.inc
[Debug - 16:56:37.740] Declared extensions of language TypeScript were converted to ts: **/*.ts,**/*.tsx
[Debug - 16:56:37.740] Declared extensions of language JavaScript were converted to js: **/*.js,**/*.jsx,**/*.vue
[Debug - 16:56:37.740] Declared extensions of language PL/SQL were converted to plsql: **/*.sql,**/*.pks,**/*.pkb
[Info  - 16:56:37.741] Index files
[Debug - 16:56:37.741] Language of file 'file:///v:/VBO_DEV/Preproduction/Release0/Current/ADHOC/PACKAGES/pkg_lcm_recursive.sql' is set to 'plsql'
[Info  - 16:56:37.741] 1 file indexed
[Debug - 16:56:37.742] Quality profiles:
[Debug - 16:56:37.742]   * js: 'Sonar way (outdated copy)' (84 rules)
[Debug - 16:56:37.742]   * jsp: 'Sonar way' (0 rules)
[Debug - 16:56:37.743]   * php: 'Sonar way' (101 rules)
[Debug - 16:56:37.744]   * plsql: 'LogToolRules' (112 rules)
[Debug - 16:56:37.744]   * py: 'Sonar way (outdated copy)' (31 rules)
[Debug - 16:56:37.744]   * ts: 'Sonar way' (59 rules)
[Debug - 16:56:37.745]   * web: 'Sonar way' (18 rules)
[Debug - 16:56:37.757] 'Python Squid Sensor' skipped because there is no related file in current project
[Debug - 16:56:37.757] Execute Sensor: HTML
[Debug - 16:56:37.757] 'PHP sensor' skipped because there is no related file in current project
[Debug - 16:56:37.757] 'Analyzer for "php.ini" files' skipped because there is no related file in current project
[Debug - 16:56:37.757] 'Contextual SonarTS' skipped because there is no related file in current project
[Debug - 16:56:37.758] 'SonarJS' skipped because there is no related file in current project
[Debug - 16:56:37.758] 'ESLint-based SonarJS' skipped because there is no related file in current project
[Debug - 16:56:37.758] Execute Sensor: PL/SQL Sensor
[Debug - 16:56:37.758] Setting filesystem encoding: UTF-8
[Info  - 16:56:37.766] 1 source files to be analyzed
[Debug - 16:56:37.988] Initializing metadata of file file:///v:/VBO_DEV/Preproduction/Release0/Current/ADHOC/PACKAGES/pkg_lcm_recursive.sql
[Info  - 16:56:38.015] 1/1 source files have been analyzed
[Debug - 16:56:38.018] fetchServerIssues projectKey=VSC, ideFilePath=pkg_lcm_recursive.sql
[Debug - 16:56:38.027] GET 404 http://sonar.site.geneva.com:9000/batch/issues?key=VSC%3Apkg_lcm_recursive.sql | response time=8ms
[Debug - 16:56:38.027] Downloaded issues in 8ms
[Info  - 16:56:38.029] Found 47 issue(s)