MISRA C++2023 inspired rules and improvements

We are happy to announce some improvements and additions to your C and C++ analysis.

We continued our effort taking inspiration from MISRA C++2023 to improve and align some of our rules with the latest best practices.
The reworked rules are:

  • S824 : Functions should not be declared at block scope
  • S841: “enum” members other than the first one should not be explicitly initialized unless all members are explicitly initialized
  • S955: Non-standard characters should not occur in header file names in “#include” directives
  • S5259: Header guards should be followed by according “#define” macro
  • S6200: “volatile” should not be used to qualify objects for which the meaning is not defined

As part of this effort, you also have 3 more C++ rules:

  • S6991: Macro arguments should not contain preprocessing directives
  • S6994: “static_assert” should be preferred to assert when the argument is a compile-time constant
  • S6996: A single L in a literal suffix should only be used for long values

All these will be available with SonarQube 10.7 starting from Developer Edition. They will be available shortly on SonarCloud and soon on SonarLint.

As always, you can see what’s coming next and vote for C and C++ features you would like to see in SonarQube , SonarCloud , and SonarLint .

Cheers