Introducing quick fixes in SonarLint!

Dear SonarLint users,
As you know, SonarLint aims at detecting code quality and security issues, in the very moment you are introducing them in your code, so that you are in a position to fix them as early as possible and submit cleaner pull requests.
And more generally, SonarLint’s mission is to identify and also help you fix quality and security issues as you code.
In fact, we believe helping you to fix your issues and to learn how you can deliver better and better code is a key asset of SonarLint. That is why, once an issue is detected, our rule descriptions guide you to understand why that issue was raised, what is at stake and what you should do to fix your code. At the same time, we realize that fixing an issue is not always straightforward; we then want to go one step further and enable you to fix your issues quickly and effortlessly.
This is why with this new SonarLint version we are introducing quick fixes, and to be more precise we decided to offer this functionality for Java in IntelliJ IDEs - in this first iteration.

Screen Recording 2021-09-13 at 15.54.02 (1)

What you can expect in the latest version of SonarLint for IntelliJ IDEs:

  • quick fixes for around 40 Java quality rules.
  • easy apply a quick fix 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)

What you can expect from future SonarLint versions:

  • quick fixes for more Java rules
  • quick fixes for Java in VSCode and Eclipse as well
  • we’ll also consider providing quick fixes for more languages (spoiler: C and C++ are on top of the list :wink:

We want SonarLint to be always better and more useful to the whole developer community, so don’t hesitate to share your feedback and your suggestions once you get a chance to try this new version :wink:

EDIT: if you use SonarLint in connected mode with SonarQube, quick fixes will only be available if use the latest SonarQube version (= 9.1)


UPDATE: Quick fixes are now also available for C and C++ as well, starting in CLion with the release of SonarLint for IntelliJ v6.3 :grinning:

UPDATE: Quick fixes are now also available for JavaScript and TypeScript, in VSCode, Eclipse and JetBrains IDEs.

1 Like