> For the complete documentation index, see [llms.txt](https://help.aikido.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.aikido.dev/code-quality/code-quality-setup.md).

# Code Quality in PRs

PR checks focus on **new code**, meaning the lines you add or change in a pull request. Aikido scans those changes automatically and leaves inline comments (or fails the gate) so quality issues don't make it into your main branch.

This guide walks you through setting up Code Quality in your PR / MR Checks. To scan **existing code** across a full repository and see category scores, open findings, and hotspots, see [Repository Scans](/code-quality/repository-scans.md).

## Prerequisites

Before you begin, ensure you have:

* An account connected to GitHub, Bitbucket, GitLab, or Azure DevOps Git
* Admin access to your Aikido account
* [Connected repositories to Aikido](/code-scanning/connect-your-source-code.md)

Code Quality isn't available for Local Scanning Accounts or Team Foundation Version Control (TFVC) repositories.

## Getting started <a href="#getting-started" id="getting-started"></a>

There are 3 steps in total to setup and run your first code quality steps. The Aikido UI shows clearly which steps to follow on the Code Quality page (accessible from sidebar). Below is a more extensive description.

{% stepper %}
{% step %}
**Enable Code Quality for repositories**

Choose which repositories should have Code Quality checks enabled:

1. Click **Configure Repositories** on the Code Quality Page to open the PR checks page. If you haven't configured the CI checks yet, you will be taken through the installation flow.
2. Select the repositories where you want to run Code Quality checks and enable **Code Quality Scanning**.
3. Select the lowest severity for Code Quality comments. Aikido adds comments for findings at that severity and above.
4. Enable **Fail check for open quality comments** to fail the check when Aikido finds Code Quality issues at or above the selected severity.

<div data-with-frame="true"><figure><img src="https://3149773201-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyKbzcQGrx7UtrG0nPZZ7%2Fuploads%2Fgit-blob-b820da0bcbe592cf2e8b94d0f8b3fea34352cce0%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}
**Select quality checks**

Configure which code quality rules to enforce on the Code Quality Checks page

1. Browse through the available checks organized by:
   * **Default checks** - Pre-configured best practices for multiple languages
   * **Custom checks** - Rules specific to your team (you can add these later)
2. Toggle checks on/off based on your team’s needs

<div data-with-frame="true"><figure><img src="https://3149773201-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyKbzcQGrx7UtrG0nPZZ7%2Fuploads%2Fgit-blob-921656fec8073d8083d09f137440e2093f9bad3a%2FScreenshot%202026-07-28%20at%2011.16.05.png?alt=media" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}
**Run your first scan**

Once you’ve configured repositories and checks:

1. Create a new pull request, or push a new commit to an existing pull request in one of the configured repositories. This will automatically trigger your first Code Quality scan.
2. Review the results in the **Activity** tab.
   {% endstep %}
   {% endstepper %}

When you fix a Code Quality issue, Aikido automatically resolves the comment. [Learn how Aikido manages comments after an issue is fixed](/pr-and-release-gating/aikido-ci-gating-functionality/autofix-suggestions-and-inline-commenting-for-pr-checks.md#what-happens-to-comments-after-you-fix-an-issue).

To fail the pull request when uploaded test coverage is below a percentage, see [PR Gating on Code Coverage](/code-quality/code-coverage/pr-gating-on-code-coverage.md). That setting is in the same **Code Quality Scanning** section.

## How severity is determined

Every Code Quality rule has a base severity, shown on the [**Checks** page](https://app.aikido.dev/code-quality/checks). When Aikido finds a violation, it starts with that base severity and adjusts it for the specific context. The resulting finding severity can be higher or lower than the rule's base severity.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.aikido.dev/code-quality/code-quality-setup.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `build a script that syncs our docs to a CMS` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
