Unable to load C++ custom rules on Sonar lint

  • Operating system : Microsoft Windows 10 Enterprise
  • IDE : MS Visual Studio Professional 2019 v16.11.23
  • SonarLint plugin version: 6.15.0.67199
  • Programming language : C++
  • Is connected mode used : Yes
  • SonarQube Version : Enterprise Edition, version - 8.9.10

Problem : Unable to load custom rules for C++ project on sonar lint plugin for MS visual studio 2019.

Description :

We have created some custom rules using open source cxx-community plugin :

All these rules are visible on the SonarQuebe server, and they function well on our project as well.

For on-the-fly analysis with IDE, we are attempting to set and apply these custom rules using the sonar lint extension, however we were unable to see the rules.
On checking the logs, it is observed that sonar lint is not fetching information for cxx-plugin :

How should custom rules be executed while using the sonar lint extension? Is there another approach that could work here?

Hi,

SonarLint doesn’t load third-party extensions like sonar-cxx as stated in the FAQ post:

  1. Third-party analyzers are not executed in SonarLint
    Some issues may be reported in SonarQube by a plugin leveraging a third-party analyzer (PMD, Checkstyle, ESLint, PyLint, …). SonarLint will only run rules from SonarSource analyzers including custom rules extending SonarSource analyzers . Third-party analyzers usually have their own IDE integration, so we have no plan to run them in SonarLint.

As far as I know, the official C/C++/Objective-C plugin bundled in SonarQube Enterprise Edition isn’t extensible, so it’s impossible to implement “custom rules extending SonarSource analyzers” for C++ that would be executed by SonarLint.

Thanks for your response Felipe,

I have a hard requirement to evaluate custom rules in static analysis of our code base. Is there any way to have customer C++ rules evaluated in SonarLint / SonarQube? Or should I be seeking another solution?

Thanks