AI CodeFix
AI features are only available in SonarQube Cloud Team and Enterprise plans.
Enabling AI-generated fix suggestions
AI CodeFix is an Early Access feature that generates AI-generated fix suggestions in SonarQube Cloud Team and Enterprise plans. It must be activated by an Organization Admin.
SonarQube Cloud's AI CodeFix is a feature that uses Open AI’s GPT-4o (recommended) or Anthropic Claude 3.5 Sonnet to suggest fixes for the issues detected in your projects. See the Sonar AI CodeFix terms for details about the terms of access.
As an Organization Admin, you can activate or deactivate AI-generated fix suggestions in your organization. This allows developers to get AI-based fix suggestions for the issues detected in their projects. To enable AI CodeFix:
- Go to Your Organization > Administration > Organization settings > AI CodeFix and select Enable AI CodeFix.
- Select your provider:
- OpenAI GPT-4o (Recommended)
- Anthropic Claude 3.5 Sonnet
- Once AI CodeFix is enabled, select either All projects or Only selected projects to activate the feature.
Note that if you choose Only selected projects, new projects will not be automatically enabled.
Sonar recommends using GPT-4o as your providel because it produces the best results. Using other models may produce unexpected fix suggestions that have undesirable effects.
Getting AI-generated fix suggestions
When AI-CodeFix is enabled for your organization, you can get an AI-generated fix suggestion for eligible issues. The suggestions are generated using OpenAI's GPT-4o (recommended) or Anthropic Claude 3.5 Sonnet.
To generate a fix suggestion in your IDE:
- Simply open your project in SonarQube for IntelliJ and set up connected mode with SonarQube Cloud. In your IDE, select an issue marked with the
icon, open the Rule description >
AI CodeFix tab, and select
Generate Fix. A fix will be generated in the code editor and you'll have a chance to Apply or Decline the suggestion.
To generate a fix suggestion in SonarQube Cloud:
- Select
Generate AI Fix. For more details, see the SonarQube for IntelliJ page on AI capabilities.
- Alternatively, retrieve the issue in SonarQube Cloud 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 the Generate Fix button.

An AI CodeFix will be generated, and you’ll see a diff view in the AI CodeFix tab. Simply copy and paste the generated fix into your IDE; If you're using SonarQube for IDE and have Connected mode set up, feel free to use the Open in IDE feature to streamline the process.
- If you are running SonarQube for Visual Studio, selecting Open in IDE will directly paste the fix suggestion into your IDE.
An AI Code Assurance badge is available to any SonarQube Cloud plan to mark your AI projects as reviewed by SonarQube Cloud. 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 AI settings page.
Note that for some issues, an AI CodeFix suggestion is not available.
AI Code Assurance
SonarQube Server recognizes that AI-generated code should be monitored with additional quality standards and offers administrators a series of tools described on the AI standards page.
An AI Code Assurance badge is available for any SonarQube Cloud project to mark your AI projects as reviewed by SonarQube Cloud. Any user with project access can use the badge, which can be applied to a project regardless of whether AI CodeFix is enabled.
If you’re ready to apply the badge, it works just like any other. For instructions, please see the Using a project badge article. You do not need to enable the AI CodeFix feature to use the AI Code Assurance badge.
Related pages
Was this page helpful?