Start Free
Latest | User guide | Managing issues | Fixing issues

Fixing your code issues

On this page

Depending on the issue, you may get fix suggestions:

  • In the How can I fix it? tab of the issue's detail view
  • If an AI-generated fix suggestion is available for your issue, the AI CodeFix tab will appear. Please see the Getting AI-generated fix suggestions article below for more details.

Opening issues in your IDE

To speed up the time it takes to find and fix the issue, use Connected mode to connect SonarQube Server with SonarQube for IDE and use the Open in IDE feature.

To open an issue in your IDE, it's easier if you are already running in connected mode:

  1. Retrieve the issue and open its detail view. 
  2. In the Where is the issue? tab, select Open in IDE

Getting AI-generated fix suggestions

AI-generated fix suggestions are available with SonarQube Server, Enterprise and Data Center editions for a select set of rules in Java, JavaScript, TypeScript, Python, C#, and C++. To learn more about which rules are eligible for AI CodeFix, please see the list of Rules covered with AI CodeFix.

When an Instance Admin enables AI CodeFix for your project, you can get an AI-generated fix suggestion for eligible issues. The suggestions are generated using OpenAI's GPT-4o or your own Azure OpenAI LLM Service model. 

To generate a fix suggestion: 

  • Retrieve the issue and open its detail view. If an AI CodeFix is an option for that particular issue, you will see the Generate AI Fix button.
  • From either the Where is the Issue? or the AI CodeFix tabs, select Generate Fix.
If an AI CodeFix is available for your issue, SonarQube Server will offer a Generate AI Fix button to select.

An AI CodeFix will be generated, and you’ll see a diff view in the AI CodeFix tab. If you're using SonarQube for IDE and have Connected mode set up, select View fix in IDE to streamline the process and see the diff view in your IDE. Then, simply copy and paste the generated fix into your IDE. 

  • If you are running SonarQube for Visual Studio, selecting View fix in IDE will directly paste the fix suggestion into your IDE.

The easiest way to use AI CodeFix is by using AI CodeFix in your IDE. Simply open your project in SonarQube for IntelliJ or VS Code, and set up connected mode with SonarQube Server. In your IDE, select an issue marked with the $ai-icon-sparkle icon, open the Rule description > $ai-icon-sparkleAI CodeFix tab, and select $ai-icon-sparkleGenerate Fix. A fix will be generated in the code editor and you'll have a chance to Apply or Decline the suggestion.

An AI Code Assurance badge is available to mark your AI projects as reviewed by SonarQube Server. Any user with project access can use the badge. For more detailed instructions, see the Marking a project as containing AI-generated code article on the Project settings page.


Was this page helpful?

© 2008-2025 SonarSource SA. All rights reserved. SONAR, SONARSOURCE, SONARQUBE, and CLEAN AS YOU CODE are trademarks of SonarSource SA.

Creative Commons License