AI CodeFix
SonarQube for VS Code helps to integrate AI in your IDE when it connects with your Cloud or Server instance to get AI-generated fix suggestions for issues found during your analysis.
AI features are available when running in Connected mode with SonarQube Server Enterprise and Data Center editions, and with SonarQube Cloud Subscription plans.
AI CodeFix in your IDE
AI CodeFix is a feature that generates AI-generated fix suggestions in (SonarQube Server, Cloud) and SonarQube for IntelliJ. It must be activated by a SonarQube Server or Cloud administrator. See the server documentation to enable AI CodeFix:
Enabling AI CodeFix in SonarQube Server
Enable AI CodeFix in SonarQube Cloud
About AI CodeFix
Running SonarQube for VS Code in connected mode with SonarQube Server 2025.3+ or SonarQube Cloud is required to get AI-generated fix suggestions in your IDE. See the Connection setup instructions to learn how to set up connected mode.
The suggestions are generated using the LLM selected when enabling the feature on the server. The details about how AI CodeFix works is available in the server documentation, at the links given above.
Getting AI-generated fix suggestions
With AI-CodeFix enabled in SonarQube Cloud, issues eligible for an AI-generated fix are identifiable by the ✧˖° icon found in the SonarQube for VS Code Quick Fix menu. You may need to restart your IDE if the feature was recently enabled in SonarQube Cloud and the server has not yet synced with SonarQube for VS Code.
To generate a fix suggestion:
In VS Code, select an issue in the PROBLEMS view panel or click the lightbulb in the left margin of the VS Code editor to reveal available Quick Fixes for your issue.
Select SonarQube: ✧˖° Fix with AI CodeFix ‘<YOUR_ISSUE_DESCRIPTION>’
An AI CodeFix snippet, or series of snippets if your issue is an injection vulnerability or something like a duplicated string that requires multiple snippets, will be generated and displayed with a diff view in the REFACTOR PREVIEW view panel. See the Injection vulnerabilities page for more information about those issue types.
To open a contextual diff view, select the checkbox and click on the snippet in the REFACTOR PREVIEW view panel.
Select the snippets you would like to keep, and then select Apply or Discard to accept or decline the AI CodeFix suggestion and close the REFACTOR PREVIEW view panel.

It’s also possible to use the Open in IDE button from SonarQube Cloud to navigate to your issue in the code editor. See the article on Opening issues in the IDE for more information.
Rules covered with AI CodeFix
Below you’ll find a list of Sonar Rules that are eligible for use with our AI CodeFix feature. We’ve tested each of these rules in the supported AI models and given them a confidence score to ensure they can effectively help you resolve issues. Once a rule passes our certification, it’s added to the AI CodeFix service and becomes available to you. We’re constantly working to expand this list by evaluating more rules and enhancing our AI capabilities.
Each collapsible holds a list of rules for the listed language. You will find instructions inside on how to find the detailed rule description on the Sonar Rules website.
Last updated
Was this helpful?