SonarLint for Visual Studio: v5.5 - Quick fixes for C and C++

Hello C and C++ developers,
I am happy to announce that quick fixes are now available in Visual Studio with the latest SonarLint release! :partying_face:


To apply a quick fix, you simply need to mouse hover an issue in the code editor and choose “Show Potential Fixes”, or use a shortcut (click on the light bulb or press ALT+Enter).

Here are a few examples of C++ rules where quick fixes are supported:

  • 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”

Of course there are many rules with quick fixes available, and we working to add more in this very moment. You can have a look in our rules webpage for C and for C++. And if you prefer using CLion than Visual Studio for your C and C++ projects, our rules and quick fixes are also available there :grinning:

I hope you will find this new feature useful for your everyday work!
Here are the release notes of SonarLint for Visual Studio v5.5.