> 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は、Local Scanning AccountsまたはTeam Foundation Version Control（TFVC）リポジトリでは利用できません。

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

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

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

Code Qualityチェックを有効にするリポジトリを選択してください：

1. をクリックし、 **リポジトリを設定** をCode QualityページでクリックしてPRチェックページを開きます。まだCIチェックを設定していない場合は、インストールの手順に進みます。
2. Code Qualityチェックを実行したいリポジトリを選択して有効にします **Code Qualityスキャン**.
3. Code Qualityコメントの最小重大度を選択します。Aikidoは、その重大度以上の指摘にコメントを追加します。
4. 有効化 **未解決の品質コメントでチェックを失敗させる** Aikidoが選択した重大度以上のCode Qualityの問題を見つけたときにチェックを失敗させます。

<div data-with-frame="true"><figure><img src="/files/99565b45b0f3b67bc38579c216cf7c0183ee1a80" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

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

Code Quality Checksページで適用するコード品質ルールを設定します

1. 以下で整理された利用可能なチェックを確認できます：
   * **デフォルトチェック** ・複数言語向けの事前設定済みベストプラクティス
   * **カスタムチェック** ・チーム固有のルール（後で追加できます）
2. チームのニーズに応じてチェックのオン/オフを切り替えます

<div data-with-frame="true"><figure><img src="/files/764dd8f182a99525c92d01890c92c72fe93c3524" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

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

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

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

Code Qualityの問題を修正すると、Aikidoはそのコメントを自動的に解決済みにします。 [問題修正後に Aikido がコメントをどう管理するかを学ぶ](/docs/docs-ja/pr-rirsugtingu/aikido-ci-gating-functionality/autofix-suggestions-and-inline-commenting-for-pr-checks.md#what-happens-to-comments-after-you-fix-an-issue).

## 重大度の判定方法

すべてのCode Qualityルールには基準となる重大度があり、 [**チェック** ページ](https://app.aikido.dev/code-quality/checks)に表示されます。Aikidoが違反を見つけると、その基準重大度から始めて、具体的な状況に応じて調整します。最終的な指摘の重大度は、ルールの基準重大度より高くなることも低くなることもあります。


---

# 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.
