Setting up AI Code Assurance
Setting up AI Code Assurance is a three-step process laid out in full on the Setting quality standards for AI Code Assurance page.
Assuring your AI code
SonarQube Server recognizes that AI-generated code should be monitored with additional quality standards. Recommended checks include high standards to reduce code complexity, remove bugs, and eliminate injection vulnerabilities. SonarQube’s AI Code Assurance features bring confidence that your AI-generated code is being reviewed to avoid any accountability crisis.
These objectives are achieved with three features that allow Quality Standard administrators to qualify projects as AI Code Assured:
- Label your project as containing AI code
- Apply a quality gate for AI Code Assurance
- Publish an AI Code Assurance badge externally to your websites to Monitor projects containing AI code.
Steps 1 and 2 can be accomplished using the SonarQube Server API.
Using the API to set up AI Code Assurance
To mark a project with :
curl -XPOST -H 'Authorization: Bearer <YOUR_SONARQUBE_SERVER_TOKEN>'<YOUR_SONARQUBE_URL>/api/projects/set_contains_ai_code?contains_ai_code=true&project=<YOUR_PROJECT_KEY>
To assign an AI Code Assured quality gate to a project:
curl -XPOST -H 'Authorization: Bearer <YOUR_SONARQUBE_SERVER_TOKEN>'<YOUR_SONARQUBE_URL>/api/qualitygates/select?gateName=<NAME_OF_YOUR_AI_ASSURED_QUALITY_GATE>&projectKey=<YOUR_PROJECT_KEY>
Related pages
- Overview of AI features at project level
- Overview of AI features for instance administration
- Enabling AI CodeFix at the project level to get AI-generated fix suggestions
- Overview of AI capabilities
Was this page helpful?