AI CodeFix
AI features are only available in SonarQube Cloud Team and Enterprise plans.
Sonar's AI CodeFix uses a large language model (LLM) to automatically generate AI-driven code fixes for the issues discovered by SonarQube Cloud. The feature is available with SonarQube Cloud Team and Enterprise plans.
Using AI CodeFix is simple. When you request a fix, the affected code and issue description are sent to an LLM. AI CodeFix then proposes an edit that resolves the problem without changing the code’s functionality.
Enabling AI-generated fix suggestions
SonarQube Cloud's AI CodeFix is an Early Access feature that uses Open AI’s GPT-4o (recommended) or Anthropic's Claude 3.5 or 3.7 Sonnet 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.
As an Organization Admin, you can activate or deactivate AI CodeFix for your organization at the global and project levels; see the Enabling AI CodeFix page for the full details.
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.
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. If your Engineers are using SonarQube for IntelliJ or VS Code, AI CodeFix is available in the IDE and follows the settings you defined by your quality profile.
To use AI CodeFix in SonarQube, please see the article on Getting AI-generated fix suggestions.
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 Standards for AI Code Assurance page. The feature includes labels to mark projects with AI-generated code, custom quality gates that help protect your projects, and a set of external badges to monitor projects containing AI code.
If you’ve already set up AI Code Assurance and are ready to use the badges, 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 AI Code Assurance.
Related pages
- Overview of AI capabilities
- Standards for AI-generated code
- Enabling AI CodeFix to get AI-generated fix suggestions
Was this page helpful?