> 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/docs/docs-ja/kdo/code-quality-setup.md).

# PR におけるコード品質

PRチェックの対象は **新しいコード** — プルリクエストで追加または変更した行です。Aikidoはそれらの変更を自動でスキャンし、インラインコメントを残すか、（またはゲートを失敗させることで）品質上の問題がメインブランチに入らないようにします。

このガイドでは、PR / MR チェックで Code Quality を設定する手順を案内します。スキャンするには **既存コード** リポジトリ全体にわたって — カテゴリスコア、未解決の指摘、ホットスポット — については、 [リポジトリスキャン](/docs/docs-ja/kdo/repository-scans.md).

## 前提条件

始める前に、以下を確認してください:

* GitHub、Bitbucket、GitLab、または Azure DevOps Git に接続されたアカウント
* Aikido アカウントへの管理者アクセス
* [Aikido に接続済みのリポジトリ](/docs/docs-ja/kdosukyan/connect-your-source-code.md)

Code Quality は、ローカルスキャンアカウントまたは Team Foundation Version Control (TFVC) リポジトリでは利用できません。

## はじめに <a href="#getting-started" id="getting-started"></a>

最初のコード品質チェックを設定して実行するまでの手順は、全部で 3 つあります。Aikido の UI では、Code Quality ページ（サイドバーからアクセス可能）で従うべき手順が明確に表示されます。以下に、より詳しい説明を示します。

{% stepper %}
{% step %}
**リポジトリで Code Quality を有効にする**

どのリポジトリで Code Quality チェックを有効にするかを選択します:

1. クリック **リポジトリを設定** Code Quality ページで PR チェックページを開きます。CI チェックをまだ設定していない場合は、インストール手順に進みます。
2. コード品質チェックを実行したいリポジトリを選択し、モーダル下部の Code Quality 機能を有効にします。コメントのみを追加するか、ゲートも失敗させるかを選べます。

<figure><img src="/files/99565b45b0f3b67bc38579c216cf7c0183ee1a80" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
**品質チェックを選択**

Code Quality チェックページで、どのコード品質ルールを適用するかを設定します

1. 利用可能なチェックを次の分類で見ていきます:
   * **デフォルトチェック** - 複数の言語向けに事前設定されたベストプラクティス
   * **カスタムチェック** - チーム固有のルール（後から追加できます）
2. チームのニーズに応じてチェックのオン/オフを切り替えます

<figure><img src="/files/615fb9f10e3a85551659db45fa7c548127bb9a51" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
**最初のスキャンを実行**

リポジトリとチェックを設定したら:

1. 新しいプルリクエストを作成するか、設定済みのリポジトリの既存のプルリクエストに新しいコミットをプッシュします。これにより、最初の Code Quality スキャンが自動的に開始されます。
2. 結果を確認するには **アクティビティ** タブ。
   {% endstep %}
   {% endstepper %}


---

# 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 current page URL with the `ask` query parameter, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
