Enabling rules in local SonarLint on C++ Visual Studio 2019

Please provide

  • Operating system: Windows 10
  • SonarLint plugin version: 6.15
  • Programming language you’re coding in: C++
  • Is connected mode used: No
    • Connected to SonarCloud or SonarQube (and which version): N/A

And a thorough description of the problem / question:

In extensions->sonarlint->options->edit rule settings, we are forwarded to the above settings.json file which also specifies sonar lint rules. I understand that when empty, sonarlint works on the default enabled rules and when in connected mode, sonarlint works on the rules that are enabled on the sonarqube server. I wanted to know how to populate this json file such that i can enable particular rules when im not in connected mode.

Hi @A_S,

Is the following link helpful to you? Choosing which C, Cpp, JavaScript, TypeScript or Secrets detection rules to run in Standalone mode · SonarSource/sonarlint-visualstudio Wiki · GitHub

I have one doubt on top of this,

In the above picture, how do I get that rule id/small-name? I tried visiting this link C++ static code analysis: POSIX functions should not be called with arguments that trigger buffer overflows, but I could not find a particular id or small-name for the rules.

Yes, I agree that this is not user-friendly… Sorry about that…

If you look at the link that you provided to the rule you are interested in, you can see it ends with RSPEC-5782. This means that you should put cpp:S5782 (and potentially c:S5782 too).

I see thanks a lot!

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