Setting SonarLint C++ parameter names in standalone mode

  • Operating system: Windows 10
  • Visual Studio version: VS2022
  • SonarLint plugin version: 8.3
  • Programming language you’re coding in: C++
  • Is connected mode used: No

Hi, I know it is possible to set parameter values for C++ rules in SonarLint via settings.json when used in standalone mode, however, I have no idea where/if you can find the parameter names for rules anywhere. Are they available to view without having a SonarQube server?

For example cpp:S924 has a parameter called maxNumberOfTerminationStatements but I can’t find that anywhere in the link. I only know this exists because it was used in an example in the docs.

And a follow up question, is it intentional that rules have more than one id? E.g. cpp:S924 is also cpp:SingleGotoOrBreakPerIteration?

Thanks.

Hi,

We don’t document parameter names as such, since our primary use case is setting these values through the UI. That said, you could use any SonarQube instance (Server or Cloud) to get parameter names, e.g. Next, our dogfooding instance.

Well… it’s not accidental. :sweat_smile:

This is more an artifact of history. Rules implemented very early on were given descriptive keys before we standardized on using their RSpec (Rule Specification) IDs. Several years ago we introduced the ability to smoothly migrate rule keys to standardize the outliers. But we’ve never bothered to follow through and remove the old keys. When in doubt, use the number.

 
HTH,
Ann