VSCode SonarLint plugin - Cannot disable rule locally if a project binding exists in settings

Versions

SonarLint plugin for VSCode, v3.1.0
VSCode Version: 1.63.2 (user setup)
Commit: 899d46d82c4c95423fb7e10e68eba52050e30ba3
Date: 2021-12-15T09:40:02.816Z
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT x64 10.0.19042

Steps to reproduce

  1. Add a project binding in the folder settings for your project:
    "sonarlint.connectedMode.project": {
        "projectKey": "my-project",
    },

(I think this is the default, but make sure java:S1854 is enabled for the project on the SonarQube instance)
2. In a Java method, assign an expression to a variable, but don’t use the variable in any other expression or return it:

    public void someUselessMethod() {
        List<String> someList = List.of(
            "hello",
            "world",
            "this",
            "is",
            "a",
            "list"
        );
    }
  1. Disable rule java:S1854 (useless assignment) by adding the following to settings.json:
"java:S1854": {
    "level": "off"
},

Expected result: The useless assignment issue is not flagged as an issue by SonarLint
Actual result: SonarLint flags almost the entire expression as a warning.

image

I did verify that the User setting for the disabled rule isn’t overridden by a workspace or folder setting.

As a side note, the This is particularly distracting when writing longer expressions, such as when using Streams, and makes it difficult to read the code. A less distracting implementation might be to highlight only the variable name as a warning.

Hello, thank you for reporting this.

This is the expected behavior, as documented on the sonarlint.rules property: in connected mode, analysis settings come from the server and local configuration of rule activation is ignored.