How to Use Sonar AI Code Fix in Current Project and Validate Fixes

Hi team,

I’m interested in using the Sonar AI Code Fix feature in my current project on SonarCloud. I would like to understand the following:

  1. How to enable or access Sonar AI Code Fix in a project that is already integrated with SonarCloud.
  2. How the suggested AI fixes are presented (e.g., through the UI, as pull request comments, etc.).
  3. Whether the AI fixes can be validated or previewed before applying them to the source code.
  4. Are there any limitations or prerequisites ?

Appreciate any help or guidance from the community or support team!

Thank you in advance!

Hello @rajeev5x

I hope you’ll find the necessary information in the SonarSource documentation at AI CodeFix | SonarQube Cloud Documentation.

To summarize the key points about the SonarQube AI Code Fix feature:

  1. Enabling AI Code Fix:
  • The AI Code Fix feature is automatically enabled for SonarCloud projects. There is no additional setup required on your end.
  1. Accessing the AI Fixes:
  • The suggested AI fixes are presented directly in the SonarCloud user interface. You can view them on the Issues page and in the detailed issue views.
  • AI fixes may also be provided as comments in pull requests, allowing you to review and apply them directly from your code hosting platform.
  1. Validating AI Fixes:
  • The AI fixes can be previewed before applying them to your source code. You can review the suggested changes and validate that they are appropriate for your codebase.
  1. Limitations and Prerequisites:
  • The AI Code Fix feature is currently available for Java, JavaScript, and TypeScript projects hosted on SonarCloud.
  • There are no other specific prerequisites, as the feature is automatically enabled for supported languages and projects.

I hope this overview helps provide the information you were looking for. Let me know if you have any other questions!

Hi,

Actually AI Code Fix has to be enabled by an organization admin.

Fixes are available in the UI and in your IDE under some circumstances.

 
HTH,
Ann