Sonarlint VS Code plugin problems with "Skip analysis for SCM ignored file"

Please provide

  • Linux
  • Visual Code
  • SonarLint plugin version: 3.5.4
  • Is connected mode used:
    • Connected to SonarQube ( * 8.9.6):

I have created a compiler database json file using the Makefile Tools plugin.
I have activated sonarlint logs.
My settings.json file is approximately -

{
    "makefile.configurations": [
      {
        "name": "MyLinuxConfig",
      },    
    ],
    "makefile.makefilePath": "/home/RemoteVM_Debug_X86_64/Linux.mak",
    "makefile.makePath": "/usr/bin/make",
    "makefile.compileCommandsPath": ".vscode/compile_commands.json",

    "sonarlint.ls.javaHome": "/home/.vscode/extensions/sonarsource.sonarlint_managed-jre/jre/jdk-11.0.12+7-jre",
    "sonarlint.connectedMode.connections.sonarqube": [
        {
          "serverUrl": "https://sonarqube.mycompany.com",
          "token": "210ac...."
        }
    ],
    "sonarlint.connectedMode.project": {
      "projectKey": "ANACRONYM"
    },
    "sonarlint.pathToCompileCommands": "/home/RemoteVM_Debug_X86_64/.vscode/compile_commands.json",
    "sonarlint.output.showVerboseLogs": true,
    "sonarlint.output.showAnalyzerLogs": true
}

My logs show

[Debug - 13:47:46.009] Starting connected SonarLint engine for '<default>'...
[Debug - 13:47:46.060] Plugin 'JavaScript/TypeScript/CSS Code Quality and Security' requires Node.js 12.22.0. Skip loading it.
[Warn  - 13:47:46.071] Plugin 'secrets' embeds dependencies. This will be deprecated soon. Plugin should be updated.
[Debug - 13:47:46.137] Loaded 11 plugins
[Debug - 13:47:46.137]   * License for SonarLint 8.9.6.50800 (license)
[Debug - 13:47:46.137]   * Python Code Quality and Security 3.4.1.8066 (python)
[Debug - 13:47:46.137]   * CFamily Code Quality and Security 6.33.0.46593 (cpp)
[Debug - 13:47:46.137]   * Java Code Quality and Security 6.15.1.26025 (java)
[Debug - 13:47:46.137]   * HTML Code Quality and Security 3.6.0.3106 (web)
[Debug - 13:47:46.137]   * XML Code Quality and Security 2.2.0.2973 (xml)
[Debug - 13:47:46.137]   * PHP Code Quality and Security 3.17.0.7439 (php)
[Debug - 13:47:46.137]   * SonarTS 2.1.0.4359 (typescript)
[Debug - 13:47:46.137]   * Apex Code Quality and Security 1.8.3.2219 (sonarapex)
[Debug - 13:47:46.137]   * Sonar Secrets Plugin for SonarQube 1.1.0.36766 (secrets)
[Debug - 13:47:46.137]   * PL/SQL Code Quality and Security 3.6.1.3873 (plsql)
[Debug - 13:47:47.431] Creating container for module 'file:///home//RemoteVM_Debug_X86_64'
[Debug - 13:47:47.435] SonarLint engine started for connection '<default>'
[Debug - 13:47:47.437] Connecting to server event-stream at 'api/push/sonarlint_events?projectKeys=ANACRONYM&languages=apex,c,cpp,web,java,js,php,plsql,py,secrets,ts,xml'...
[Debug - 13:47:47.497] Resolved binding ProjectBinding[idePathPrefix=,projectKey=ANACRONYM,sqPathPrefix=LinuxSource] for folder /home//RemoteVM_Debug_X86_64
[Debug - 13:47:47.622] Server events not supported by the server
[Debug - 13:47:51.362] Queuing analysis of file 'file:///home//RemoteVM_Debug_X86_64/OpenSSLTCPSocket.cpp' (version 45)
[Debug - 13:47:51.362] Skip analysis for SCM ignored file: 'file:///home/RemoteVM_Debug_X86_64/OpenSSLTCPSocket.cpp'
[Debug - 13:47:56.448] GET 200 https://sonarqube.mycompany.com/api/developers/search_events?projects=ANACRONYM&from=2022-06-08T13%3A45%3A56%2B0000 | response time=195ms
Folder file:///home/RemoteVM_Debug_X86_64 is now on branch master
[Debug - 13:47:57.117] Folder file:///home/RemoteVM_Debug_X86_64 is now on branch master.
[Debug - 13:48:56.687] GET 200 https://sonarqube.mycompany.com/api/developers/search_events?projects=ANACRONYM&from=2022-06-08T13%3A45%3A56%2B0000 | response time=434ms
[Debug - 13:49:56.445] GET 200 https://sonarqube.mycompany.com/api/developers/search_events?projects=ANACRONYM&from=2022-06-08T13%3A45%3A56%2B0000 | response time=193ms
[Debug - 13:50:56.676] GET 200 https://sonarqube.mycompany.com/api/developers/search_events?projects=ANACRONYM&from=2022-06-08T13%3A45%3A56%2B0000 | response time=424ms
[Debug - 13:51:56.458] GET 200 https://sonarqube.mycompany.com/api/developers/search_events?projects=ANACRONYM&from=2022-06-08T13%3A45%3A56%2B0000 | response time=206ms
[Debug - 13:52:56.691] GET 200 https://sonarqube.mycompany.com/api/developers/search_events?projects=ANACRONYM&from=2022-06-08T13%3A45%3A56%2B0000 | response time=439ms

I think my problem is the “Skip analysis for SCM ignored file”.
So when I open OpenSSLTCPSocket.cpp and try to inject a sonarlint error - nothing happens.

Please advise me how I can get the analysis to actually be performed.

I’d like to explain my own personal setup a bit more clearly in case that might help explain why sonarlint is failing.
I use IBM Rational Rhapsody to autogenerate my source code from a UML model.
Therefore my git files are model files rather than ordinary source files (which can just be regenerated at the touch of a button). The source folder is git ignored for this reason.
Perhaps sonarlint being connected to my sonarqube project is somehow ignoring my source code even when I delete the .gitignore files locally. If I edit my settings.json file to remove connectedMode then sonarlint starts to analyse my files. How can I use connectedMode and analyse my files which git normally ignores?

@shanz1999 just to clarify, the files are analysed in standalone mode, but not in connected mode?

If that is the case, do you have any inclusions/exclusions set on the server e.g. sonar.exclusions?

Hello Duncan,
No I don’t have any.
I have set sonar.scm.disabled
and perhaps after some time, it seems to have begun to analyse my source files.

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