This version of the SonarQube documentation is no longer maintained. It relates to a version of SonarQube that is not active.

Fixing issues

From the Enterprise edition, you can get AI-suggested fixes for your code issues.

Depending on the issue, you may get fix suggestions:

  • In the How can I fix it? tab of the Retrieving issues.

  • From the Enterprise edition, generated through AI: see Getting AI-generated fix suggestions below.

Opening issues in your IDE

To speed up the time it takes to find and fix the issue, you can open the issue in your IDE provided the SonarLint Connected Mode has been properly set up in order to connect SonarLint with SonarQube.

If you’ve already fixed the issue in your code, SonarLint will not be able to find it in the IDE; only matching code will be highlighted. Keep in mind that the revision or branch analyzed by SonarQube may not be the same as what you have opened in the IDE. When setting up Connected Mode, SonarLint considers the branch currently checked out in the IDE and tries to synchronize it with the most appropriate branch from the server (This is called branch matching in SonarLint).

To open an issue in your IDE:

  1. Retrieving issues and open its detail view.

  2. In the Where is the issue? tab, select Open in IDE.

Getting AI-generated fix suggestions

This feature is available in Early Access, in Enterprise Edition and above.

If AI-generated fix suggestions, you can generate fix suggestions for the issues detected in your projects. The suggestions are generated using OpenAI’s GPT-4.

To generate a fix suggestion:

  1. Retrieving issues and open its detail view.

  2. Go to the Where is the Issue or the Code Fix tab and click the Generate Fix button.

You can then copy the generated fix suggestion to your IDE:

  • manually, by copying and pasting the suggestion into your IDE.

  • using the Code Fix > View Fix in IDE button if you use SonarLint Connected Mode. This feature is available with SonarLint for VS Code, IntelliJ, and Eclipse.

Note that for some issues, AI-generated fix suggestions are not available.

Last updated

Was this helpful?