20

I have installed sonar lint extension on my visual studio code editor and I was wondering if there is a way to enable or disable the rules which are used by the analyzer? There is a way to do it in Visual Studio and Eclipse but I couldn't find a way to enable or disable the rules on Visual Studio Code.

I do have SonarQube running on my local server where I can disable and enable the rules from the Admin UI page. If there is a way to configure the SonarLint with the server, that would be cool. But I am not sure how to do it. If anyone does, please point me in a right direction.

thepurpleowl
  • 147
  • 4
  • 15
ShellZero
  • 4,415
  • 12
  • 38
  • 56

2 Answers2

9

Goto settings and search for sonarlint enter image description here

Click on Edit in settings.json

Add to "sonarlint.rules": the rule you wand to disable as follow:

    "javascript:S1488": {
        "level": "off"
    }

the rule code is displayed in the floating box enter image description here

Elia Weiss
  • 8,324
  • 13
  • 70
  • 110
3

Currently there is no way to use the connected mode which allows the user to configure (enable/disable) the rules on the SonarLint.

According to the discussion on the SonarLint Google Group.

It's very likely that this feature will be added soon (within the year), as we already started developing it for other flavors of SonarLint (Eclipse).

This feature is currently in work in progress and can be tracked here

ShellZero
  • 4,415
  • 12
  • 38
  • 56
  • 2
    This feature works for user settings, but does *not* work for workspace settings. This is very frustrating, because some rules might be appropriate for one repo, but not another. Also, makes management of large teams difficult, as one would need to make sure that the user settings are the same for all users. – CNad Jul 23 '20 at 16:57