SonarLint shows warning messages from rules temporary in the Problems tab for a few seconds and then disappears them

Hi All,
I’m using SonarLint and it connects to SonarQube. There are rules on the SonarQube side that throw warning messages and those are caught by SonarLint for very short, and not shown in the Problems tab.
I’m using version 2.1.2 of SonarLint, java 11 and latest node.js version in the config.

In this post - SonarLint for VS Code does not show the hits in problems view when custom rules are used - #12 by SebG
I find that the OP (@SebG ) had to turn off some vscode settings.
Wondering what are they?

To all that could potentially have the same issue.
I had to add the sonarlint.rules section:

"sonarlint.rules": {
        "typescript:S1854": {
            "level": "on"
        }
        ...
}

Strange, but made SonarLint work on my vscode in windows.

Hello, welcome to the community and thanks for your question!

It seems weird to me that adding sonarlint.rules to your settings makes connected mode work. This property is supposed to be ignored in connected mode, precisely because SonarLint is supposed to use the rules configured in your quality profile on the server.

Could you please share with us:

  • The sonarlint.* properties from your VSCode user settings (make sure that you redact out your SonarQube user token :sweat_smile:)
  • The sonarlint.* settings from your VSCode workspace/folder settings
  • A relevant extract of the SonarLint output with "sonarlint.output.showVerboseLogs": true

Please also make sure that your SonarQube bindings are up-to-date, using command “SonarLint: Update all project bindings to SonarQube/SonarCloud”.

Here it is (I must have hidden the sensitive data)

// project settings
{
    "vrdev.maven.profile": "acm_test8_4",
    "sonarlint.connectedMode.project": {
        "connectionId": "yyyyyyy",
        "projectKey": "95cd71365112xxxxxxxxxxxxxxxxxxx3b41aa"        
    }
}


//vscode settings
"sonarlint.ls.javaHome": "C:\\Program Files\\Java\\jdk-14.0.2",
    "sonarlint.pathToNodeExecutable": "C:\\Program Files\\nodejs\\node.exe",
    "sonarlint.connectedMode.connections.sonarqube": [
        {
            "connectionId": "yyyyyyy",
            "serverUrl": "http://sonar.infra.xxxxxxxxxxxxx:9000",
            "token": "95cd71365112xxxxxxxxxxxxxxxxxxx3b41aa",
            "disableNotifications": false
        }
    ],
    "sonarlint.output.showAnalyzerLogs": true,
    "sonarlint.output.showVerboseLogs": true,
    "sonarlint.disableTelemetry": true,
    "sonarlint.trace.server": "verbose",
    "sonarlint.rules": {
        "typescript:S1854": {
            "level": "on"
        },
        "typescript:S3498": {
            "level": "on"
        },
        "typescript:S1533": {
            "level": "on"
        },
        "typescript:S1440": {
            "level": "on"
        },
        "typescript:S3533": {
            "level": "on"
        },
        "typescript:S905": {
            "level": "on"
        },
        "typescript:S4136": {
            "level": "on"
        },
        "typescript:S1116": {
            "level": "on"
        },
    }
	

sonarlint output.txt (18.7 KB)

Thanks,
Igor Micev

Hi @Igor_Micev ,

In my case, the new version of Sonarlint expected new settings definition in VSCode setting.json

My problem occured with the new version of Sonarlint extension without updating settings according to new version requirements. (See extension documentation).

Hello, thank you for the additional information.

Could you please remove the "sonarlint.trace.server" property? It results in all Language Server Protocol (LSP) messages being dumped to the SonarLint output and should only be used when investigating LSP-related issues, since it results in a VERY verbose (and hardly exploitable) output.

I don’t see anything obviously strange in your settings. The one thing that I’m curious about is the "sonarlint.rules" array: in connected mode, it should not be needed, and it will be completely ignored, since the rules from the server’s quality profile should apply instead.

There are rules on the SonarQube side that throw warning messages and those are caught by SonarLint for very short, and not shown in the Problems tab.

If you remove (or comment out) the "sonarlint.rules" array from your settings, could you please provide examples of issues raised by SonarQube but not by SonarLint? This might be an issue with the underlying project configuration.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.