Enabling AI CodeFix
AI features are only available in SonarQube Cloud Team and Enterprise plans.
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 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's Claude 3.5 or 3.7 Sonnet to suggest fixes for some 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
- Anthropic Claude 3.7 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
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 connected mode.
The easiest way to use AI CodeFix is by opening the issue directly 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.
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 Setting quality standards for AI Code Assurance page.
Related pages
- Overview of SonarCloud's AI capabilities
- Information about Setting up AI code autodetection
- Setting permissions for AI Autodetection in your DevOps integration
- To learn about AI Code Assurance:
Was this page helpful?