SonarLint VSCode not working with ConnectMode rules

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    Versions - SonarQube 8.1. SonarLint 1.13.0

  • what are you trying to achieve
    Get my company rules to work on VSCode via connectedMode.
    It is all set up correctly, but SonarLint is not reporting any issues.

  • what have you tried so far to achieve this
    I thought it was something to do with ESLint. I’ve tired changing versions of node.
    I remove the connectedMode.project from my workspace, and it works with default SonarQube rules.
    As soon as I create the link from project to server, it doesn’t show any rules that I know are activated.
    Looking at the output console there doesn’t seem to be any issue installing/binding sonar lint.
    The reason I was going at the eslint is because I noticed eslint-bridge was being used, but in a different version of node to that I use for this project. I got that working correctly, but still no joy.

Hi,

Could you share SonarLint output content when:

  • updating the binding
  • opening a JS file

Sure thing.

Updating the bind:

eslint-bridge server will shutdown 

Create : /Users/filipe.oliveira/.sonarlint/plugins

Plugin cache: /Users/filipe.oliveira/.sonarlint/plugins

Create : /Users/filipe.oliveira/.sonarlint/plugins/_tmp

GET 200 https://sonarqube.corehr.com/api/system/status | response time=35ms

Downloaded server infos in 37ms

GET 200 https://sonarqube.corehr.com/api/plugins/installed | response time=10ms

[Info - 4:32:08 PM] Downloaded plugin list in 17ms

GET 200 https://sonarqube.corehr.com/api/settings/values.protobuf | response time=17ms

[Info - 4:32:08 PM] Downloaded settings in 23ms

Code analyzer 'scmgit' is not compatible with SonarLint. Skip downloading it.

Code analyzer 'jacoco' is not compatible with SonarLint. Skip downloading it.

Code analyzer 'abap' is not compatible with SonarLint. Skip downloading it.

Code analyzer 'csharp' is not compatible with SonarLint. Skip downloading it.

Code analyzer 'cpp' is not compatible with SonarLint. Skip downloading it.

Code analyzer 'cobol' is not compatible with SonarLint. Skip downloading it.

Code analyzer 'cssfamily' is not compatible with SonarLint. Skip downloading it.

Code analyzer 'flex' is not compatible with SonarLint. Skip downloading it.

Code analyzer 'go' is not compatible with SonarLint. Skip downloading it.

Code analyzer 'java' is not compatible with SonarLint. Skip downloading it.

Code analyzer 'kotlin' is not compatible with SonarLint. Skip downloading it.

Code analyzer 'pli' is not compatible with SonarLint. Skip downloading it.

Code analyzer 'rpg' is not compatible with SonarLint. Skip downloading it.

Code analyzer 'ruby' is not compatible with SonarLint. Skip downloading it.

Code analyzer 'sonarscala' is not compatible with SonarLint. Skip downloading it.

Code analyzer 'swift' is not compatible with SonarLint. Skip downloading it.

Code analyzer 'tsql' is not compatible with SonarLint. Skip downloading it.

Code analyzer 'vbnet' is not compatible with SonarLint. Skip downloading it.

Code analyzer 'vb' is not compatible with SonarLint. Skip downloading it.

Code analyzer 'xml' is not compatible with SonarLint. Skip downloading it.

Code analyzer 'scmsvn' is not compatible with SonarLint. Skip downloading it.

Code analyzer 'security' is not compatible with SonarLint. Skip downloading it.

Code analyzer 'securitycsharpfrontend' is not compatible with SonarLint. Skip downloading it.

Code analyzer 'securityjavafrontend' is not compatible with SonarLint. Skip downloading it.

Code analyzer 'securityphpfrontend' is not compatible with SonarLint. Skip downloading it.

Code analyzer 'securitypythonfrontend' is not compatible with SonarLint. Skip downloading it.

Code analyzer 'yaml' is not compatible with SonarLint. Skip downloading it.

GET 200 https://sonarqube.corehr.com/api/rules/search.protobuf?f=repo,name,severity,lang,htmlDesc,htmlNote,internalKey,isTemplate,templateKey,actives&statuses=BETA,DEPRECATED,READY&types=CODE_SMELL,BUG,VULNERABILITY&severities=INFO&p=1&ps=500 | response time=71ms

GET 200 https://sonarqube.corehr.com/api/rules/search.protobuf?f=repo,name,severity,lang,htmlDesc,htmlNote,internalKey,isTemplate,templateKey,actives&statuses=BETA,DEPRECATED,READY&types=CODE_SMELL,BUG,VULNERABILITY&severities=MINOR&p=1&ps=500 | response time=475ms

GET 200 https://sonarqube.corehr.com/api/rules/search.protobuf?f=repo,name,severity,lang,htmlDesc,htmlNote,internalKey,isTemplate,templateKey,actives&statuses=BETA,DEPRECATED,READY&types=CODE_SMELL,BUG,VULNERABILITY&severities=MINOR&p=2&ps=500 | response time=159ms

GET 200 https://sonarqube.corehr.com/api/rules/search.protobuf?f=repo,name,severity,lang,htmlDesc,htmlNote,internalKey,isTemplate,templateKey,actives&statuses=BETA,DEPRECATED,READY&types=CODE_SMELL,BUG,VULNERABILITY&severities=MINOR&p=3&ps=500 | response time=98ms

GET 200 https://sonarqube.corehr.com/api/rules/search.protobuf?f=repo,name,severity,lang,htmlDesc,htmlNote,internalKey,isTemplate,templateKey,actives&statuses=BETA,DEPRECATED,READY&types=CODE_SMELL,BUG,VULNERABILITY&severities=MAJOR&p=1&ps=500 | response time=229ms

GET 200 https://sonarqube.corehr.com/api/rules/search.protobuf?f=repo,name,severity,lang,htmlDesc,htmlNote,internalKey,isTemplate,templateKey,actives&statuses=BETA,DEPRECATED,READY&types=CODE_SMELL,BUG,VULNERABILITY&severities=MAJOR&p=2&ps=500 | response time=179ms

GET 200 https://sonarqube.corehr.com/api/rules/search.protobuf?f=repo,name,severity,lang,htmlDesc,htmlNote,internalKey,isTemplate,templateKey,actives&statuses=BETA,DEPRECATED,READY&types=CODE_SMELL,BUG,VULNERABILITY&severities=MAJOR&p=3&ps=500 | response time=142ms

GET 200 https://sonarqube.corehr.com/api/rules/search.protobuf?f=repo,name,severity,lang,htmlDesc,htmlNote,internalKey,isTemplate,templateKey,actives&statuses=BETA,DEPRECATED,READY&types=CODE_SMELL,BUG,VULNERABILITY&severities=MAJOR&p=4&ps=500 | response time=135ms

GET 200 https://sonarqube.corehr.com/api/rules/search.protobuf?f=repo,name,severity,lang,htmlDesc,htmlNote,internalKey,isTemplate,templateKey,actives&statuses=BETA,DEPRECATED,READY&types=CODE_SMELL,BUG,VULNERABILITY&severities=CRITICAL&p=1&ps=500 | response time=197ms

GET 200 https://sonarqube.corehr.com/api/rules/search.protobuf?f=repo,name,severity,lang,htmlDesc,htmlNote,internalKey,isTemplate,templateKey,actives&statuses=BETA,DEPRECATED,READY&types=CODE_SMELL,BUG,VULNERABILITY&severities=CRITICAL&p=2&ps=500 | response time=59ms

GET 200 https://sonarqube.corehr.com/api/rules/search.protobuf?f=repo,name,severity,lang,htmlDesc,htmlNote,internalKey,isTemplate,templateKey,actives&statuses=BETA,DEPRECATED,READY&types=CODE_SMELL,BUG,VULNERABILITY&severities=BLOCKER&p=1&ps=500 | response time=228ms

GET 200 https://sonarqube.corehr.com/api/qualityprofiles/search.protobuf | response time=48ms

Downloaded quality profiles in 53ms

GET 200 https://sonarqube.corehr.com/api/components/search.protobuf?qualifiers=TRK&ps=500&p=1 | response time=22ms

Page downloaded in 25ms

Create : /Users/filipe.oliveira/.sonarlint/plugins

Plugin cache: /Users/filipe.oliveira/.sonarlint/plugins

Create : /Users/filipe.oliveira/.sonarlint/plugins/_tmp

Load plugins

Load plugins (done) | time=19ms

Plugins:

* License for SonarLint 8.1.0.31237 (license)

* SonarPython 2.4.0.5513 (python)

* SonarHTML 3.2.0.2082 (web)

* SonarPHP 3.3.0.5166 (php)

* SonarTS 2.1.0.4359 (typescript)

* SonarApex 1.7.0.883 (sonarapex)

* SonarJS 6.2.0.12043 (javascript)

* SonarPLSQL 3.4.1.2576 (plsql)

[Info - 4:32:11 PM] Using storage for server '88AEEF58-AWaGVz0XakDkJykYi-XD' (last update 07/02/20 16:32)

GET 200 https://sonarqube.corehr.com/api/qualityprofiles/search.protobuf?project=UI_Framework | response time=61ms

Downloaded project quality profiles in 61ms

GET 200 https://sonarqube.corehr.com/api/settings/values.protobuf?component=UI_Framework | response time=34ms

[Info - 4:32:11 PM] Downloaded settings in 35ms

GET 200 https://sonarqube.corehr.com/api/components/tree.protobuf?qualifiers=BRC&component=UI_Framework&ps=500&p=1 | response time=10ms

Page downloaded in 12ms

GET 200 https://sonarqube.corehr.com/batch/issues?key=UI_Framework | response time=255ms

Downloaded issues in 259ms

GET 200 https://sonarqube.corehr.com/api/components/tree.protobuf?qualifiers=FIL,UTS&component=UI_Framework&ps=500&p=1 | response time=54ms

Page downloaded in 60ms

GET 200 https://sonarqube.corehr.com/api/components/tree.protobuf?qualifiers=FIL,UTS&component=UI_Framework&ps=500&p=2 | response time=46ms

Page downloaded in 48ms

GET 200 https://sonarqube.corehr.com/api/qualityprofiles/search.protobuf?project=UI_Framework | response time=76ms

Downloaded project quality profiles in 77ms

GET 200 https://sonarqube.corehr.com/api/settings/values.protobuf?component=UI_Framework | response time=24ms

[Info - 4:32:11 PM] Downloaded settings in 25ms

GET 200 https://sonarqube.corehr.com/api/components/tree.protobuf?qualifiers=BRC&component=UI_Framework&ps=500&p=1 | response time=11ms

Page downloaded in 11ms

GET 200 https://sonarqube.corehr.com/batch/issues?key=UI_Framework | response time=163ms

Downloaded issues in 169ms

GET 200 https://sonarqube.corehr.com/api/components/tree.protobuf?qualifiers=FIL,UTS&component=UI_Framework&ps=500&p=1 | response time=48ms

Page downloaded in 53ms

GET 200 https://sonarqube.corehr.com/api/components/tree.protobuf?qualifiers=FIL,UTS&component=UI_Framework&ps=500&p=2 | response time=46ms

Page downloaded in 47ms

Opening a JS file:

Resolved binding ProjectBinding[projectKey=UI_Framework,sqPathPrefix=,idePathPrefix=] for folder /Users/filipe.oliveira/Documents/git/corePortal

Server excluded sources:

**/ext/**/*

**/packages/local/**/*

**/WEB-INF/**/*

**/data/**/*

**/libV2/**/*

**/resources/**/*

**/packages/remote/bryntum*/**/*

**/packages/remote/charts/**/*

**/packages/remote/d3/**/*

**/packages/remote/package-loader/**/*

**/packages/remote/pivot*/**/*

**/babel/**/*

**/boot/**/*

Analysis triggered on 'file:///Users/filipe.oliveira/Documents/git/corePortal/packages/remote/coreframework/classic/src/CoreUtils.js' with configuration:

[

projectKey: UI_Framework

baseDir: /Users/filipe.oliveira/Documents/git/corePortal

extraProperties: {}

inputFiles: [

file:///Users/filipe.oliveira/Documents/git/corePortal/packages/remote/coreframework/classic/src/CoreUtils.js (UTF-8) [js]

]

]

Available languages:

* Python => "py"

* HTML => "web"

* JSP => "jsp"

* PHP => "php"

* Apex => "apex"

* JavaScript => "js"

* TypeScript => "ts"

* PL/SQL => "plsql"

Start analysis

Declared extensions of language Python were converted to py: **/*.py

Declared extensions of language HTML were converted to web: **/*.html,**/*.xhtml,**/*.cshtml,**/*.vbhtml,**/*.aspx,**/*.ascx,**/*.rhtml,**/*.erb,**/*.shtm,**/*.shtml

Declared extensions of language JSP were converted to jsp: **/*.jsp,**/*.jspf,**/*.jspx

Declared extensions of language PHP were converted to php: **/*.php,**/*.php3,**/*.php4,**/*.php5,**/*.phtml,**/*.inc

Declared extensions of language Apex were converted to apex: **/*.cls,**/*.trigger

Declared extensions of language JavaScript were converted to js: **/*.js,**/*.jsx,**/*.vue

Declared extensions of language TypeScript were converted to ts: **/*.ts,**/*.tsx

Declared extensions of language PL/SQL were converted to plsql: **/*.sql,**/*.pks,**/*.pkb,**/*.pak,**/*.bod,**/*.proc,**/*.fn

[Info - 4:33:23 PM] Index files

Language of file 'file:///Users/filipe.oliveira/Documents/git/corePortal/packages/remote/coreframework/classic/src/CoreUtils.js' is set to 'js'

[Info - 4:33:23 PM] 1 file indexed

Quality profiles:

* apex: 'Sonar way' (38 rules)

* js: 'Core way' (109 rules)

* jsp: 'Sonar way' (0 rules)

* php: 'Sonar way' (96 rules)

* plsql: 'Core way' (102 rules)

* py: 'Sonar way' (54 rules)

* ts: 'Sonar way' (66 rules)

* web: 'Sonar way' (28 rules)

'Python Sensor' skipped because there is no related file in current project

Execute Sensor: HTML

'PHP sensor' skipped because there is no related file in current project

'Analyzer for "php.ini" files' skipped because there is no related file in current project

'SonarTS' skipped because there is no related file in current project

'Apex Sensor' skipped because there is no related file in current project

Execute Sensor: JavaScript analysis

Deploying bundle

Deploying eslint-bridge into /Users/filipe.oliveira/.sonarlint/work/.sonartmp_109981603979177719/eslint-bridge-bundle

Deploying bundle (done) | time=1570ms

Starting server

Using default Node.js executable: '/Users/filipe.oliveira/.sonarlint/work/.sonartmp_109981603979177719/eslint-bridge-bundle/package/node_modules/run-node/run-node'.

Checking Node.js version

Launching command /Users/filipe.oliveira/.sonarlint/work/.sonartmp_109981603979177719/eslint-bridge-bundle/package/node_modules/run-node/run-node -v

Using Node.js v10.16.0.

Starting Node.js process to start eslint-bridge server at port 58505

Launching command /Users/filipe.oliveira/.sonarlint/work/.sonartmp_109981603979177719/eslint-bridge-bundle/package/node_modules/run-node/run-node /Users/filipe.oliveira/.sonarlint/work/.sonartmp_109981603979177719/eslint-bridge-bundle/package/bin/server 58505

starting eslint-bridge server at port 58505

eslint-bridge server is running at port 58505

Starting server (done) | time=3718ms

[Info - 4:33:29 PM] 1 source files to be analyzed

Initializing metadata of file file:///Users/filipe.oliveira/Documents/git/corePortal/packages/remote/coreframework/classic/src/CoreUtils.js

[Info - 4:33:30 PM] 1/1 source files have been analyzed

[Info - 4:33:30 PM] Sensor SonarJS [javascript]

[Info - 4:33:30 PM] 1 source files to be analyzed

[Info - 4:33:31 PM] Sensor SonarJS [javascript] (done) | time=703ms

[Info - 4:33:31 PM] 1/1 source files have been analyzed

'TypeScript analysis' skipped because there is no related file in current project

'PL/SQL Sensor' skipped because there is no related file in current project

fetchServerIssues projectKey=UI_Framework, ideFilePath=packages/remote/coreframework/classic/src/CoreUtils.js

GET 200 https://sonarqube.corehr.com/batch/issues?key=UI_Framework%3Apackages%2Fremote%2Fcoreframework%2Fclassic%2Fsrc%2FCoreUtils.js | response time=44ms

Downloaded issues in 44ms

Thanks for the logs. Everything looks good, the analysis is running fine.

I see you are using a custom quality profile (Core way) for JS language. Can you give us an example of a rule (with the rule key) that is raising an issue on SonarQube side, and that you don’t see on VSCode?

Maybe also share a code example if you can where you expect an issue to be raised.

Last thing to check: what is the rule severity? Issues with severity INFO are only displayed in the code editor in VSCode (not listed in the problems panel).

So the rule is Javascript Function parameters with default values should be last

I have the severity now as a blocker.

The piece of code is the following:
reprocessTheme(theme = {}, isIE = false, callback) {

There is another rule JS All code should be reachable which is not working.
But I have the following there so wondering if ESLint is somehow communicating with Sonarlint.
// eslint-disable-next-line no-unreachable

I forgot to ask: do you see the issues when analyzing your project on SonarQube with a scanner?

Yes, it shows in sonarqube,

Hi Julien,

Finally got this working! Had nothing to do with SonarLint, it was on our end. We have the rules in an ssl server that reverse proxies to a non ssl server. There seems to be an issue internally, because when I redirect to the non ssl server, it all works as expected!

Thanks so much for the help and apologies for wasting your time!

Cheers,
Fil

1 Like

Hi @fily55

Thanks for letting us know. I’m glad you managed to fix your issue. Don’t hesitate to share more details, as I’m very concerned a network issue could silently cause such a problem. I would have expected some errors in the “update all bindings” logs.

It’s an error on our end. When the SSL server fails, it’s returning a false positive. So it was nothing on your end, completely ours!