Hello C and C++ developers,
We’re happy to announce this new version of SonarLint for IntelliJ that introduces quick fixes for selected C and C++ issues in CLion. SonarLint first introduced quick fixes for the Java community two month ago and we’ve been working in the meanwhile to provide them for C and C++ as well. With this new SonarLint release, you now have 43 of them.
We focused on either bringing fixes that are not available on the IDE or that we can provide an improved version of.
A few examples:
- S5416: “using” should be preferred for type aliasing
- S5350: Pointer and reference local variables should be “const” if the corresponding object is not modified
- S5817: Member functions that don’t mutate their objects should be declared “const”
- S1905: Redundant casts should not be used
- S1238: Pass by reference to const should be used for large input parameters
- S6030: “try_emplace” should be used with “std::map” and “std::unordered_map”
You can apply quick fixes in CLion by mousing over a SonarLint issue, or by using the configured IDE keyboard shortcut for quick fixes (typically ALT+Enter on Windows or Linux, ⌥⏎ on MacOS).
We sincerely hope you’ll find our quick fixes useful to easily fix your code issues; we plan to provide more and more of them in the future, and to make our C and C++ quick fixes available in Visual Studio and Eclipse as well.