Happy new year dear C, C++ and Objective-C users.
To start with some great new C++ features for 2023, we are glad to bring you 13 new rules to make the best of C++20’s std::format feature.
-
Rule S6185:
std::formatshould be used instead of string concatenation andstd::to_string -
Rule S6482: Explicit argument indexing in
std::formatshould be used only for non-trivial ordering - Rule S6483: Width, alignment, and padding format options should be used consistently
-
Rule S6484: Concatenated
std::formatoutputs should be replaced by a single invocation -
Rule S6487,S6488:
std::formatshould not be missing indexes -
Rule S6489: Calls to
std::formatwith a locale should use the"L"flag - Rule S6490: Arguments corresponding to width and precision formatting options should be integers
-
Rule S6491:
std::formatnumeric types should be 0-padded using the numerical padding and not the character padding -
Rule S6492: Use
std::formatrather thanstd::vformatwhen the format string is known at compile time -
Rule S6493: The result of
make_format_argsshould be passed directly as an argument -
Rule S6494: C++ formatting functions should be used instead of C
printf-like functions -
Rule S6495:
std::formatshould be used instead of standard output manipulators
These new rules will be available with SonarQube 9.9 LTS 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