Enable AI CodeFix
Enabling AI CodeFix for your SonarQube Cloud organization is a straight-forward process. Simply enable AI CodeFix in the UI, choose your LLM provider, and allow project access.
AI features are only available in SonarQube Cloud Team and Enterprise plans. See the Subscription plans page for more details.
SonarQube Cloud’s AI CodeFix is a feature that uses Anthropic's Claude Sonnet 4 (recommended) or OpenAI's GPT-4o to suggest fixes for a select set of rules in Java, JavaScript, TypeScript, Python, C#, and C++. See the Sonar AI CodeFix terms for details about the terms of access.
To learn more about which rules are eligible for AI CodeFix, please see the list of Rules covered with AI CodeFix.
Sharing your code with Sonar
If you use Sonar’s AI CodeFix LLM, the affected code snippet will be sent by the AI CodeFix service to the selected LLM. Service agreements with Sonar’s LLMs prevent your code from being used to train those models.
For details about terms and conditions, please refer to the AI CodeFix terms in our Legal Documentation.
Enabling AI-generated fix suggestions
AI CodeFix is a feature that generates AI-generated fix suggestions in SonarQube Cloud Team and Enterprise plans. It must be activated by an Organization Admin.
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:
Anthropic's Claude Sonnet 4 (recommended) or OpenAI's GPT-4o
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
Once AI CodeFix is enabled, users will be able to select Generate AI Fix on eligible issues and copy/paste the fix into their IDE with the Open in IDE feature when using SonarQube for IDE.
Usage limits
Limits are placed on the AI CodeFix feature to manage abuse. Developers will be notified directly when the monthly allocation is reached for your organization. If the instance is blocked due to reaching the allowance, users attempting to generate a fix will see an error message. Usage quotas are reset on the first day of each month.
The easiest way to use AI CodeFix is by using AI CodeFix in your IDE. When SonarQube for VS Code or SonarQube for Intellij is set up in connected mode with with SonarQube Cloud, 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.
See the SonarQube for IDE page for information about connected mode.
See the IntelliJ page for AI CodeFix
See the VS Code page for AI CodeFix
For complete details about using AI CodeFix to fix your issues in SonarQube Cloud, see the article on Getting AI-generated fix suggestions.
Marking a project as containing AI-generated code
SonarQube Server recognizes that AI-generated code should be monitored with additional quality standards and offers administrators a series of project labels and custom quality gate certifications described on the Set your AI standards page.
Related pages
Overview of SonarQube Cloud's AI capabilities
Information about Autodetect AI code
To learn about AI Code Assurance:
and use Quality gates for AI code
Last updated
Was this helpful?