0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

CodeRabbitで設定が必要なLinterまとめ

0
Posted at

CodeRabbitはAIコードレビューサービスです。GitHubやGitLabなどと連携し、PRを自動的にコードレビューします。VS Code機能拡張やCLIも提供しており、こちらは無料で利用できます。パブリックなリポジトリであれば、CodeRabbitを無料で利用できます。

CodeRabbitは、コードレビューを行う際に各種Linter/SASTツールを利用しています。ほとんどのツールはデフォルトで有効になっていますが、幾つかのルールについては設定が必要です。設定されていないと、せっかくの機能が活かせないので、ぜひ活用してください!

actionlint

.github/workflows/ がないと実行されません。

actionlint

ast-grep

reviews.tools.ast-grep 以下に対して、下記のいずれかが設定されている場合にのみ、実行されます。

  • rule_dirs
  • essential_rules
  • packages

util_dirs 設定はオプションです。

reviews:
  tools:
    ast-grep:
      rule_dirs:
        - "rules/javascript"
        - "rules/python"
      util_dirs:
        - "utils"
      essential_rules: true
      packages:
        - "owner/custom-rules"

ast-grep

CircleCI

以下のパスにファイルが必要です。

  • .circleci/config.yml
  • .circleci/config.yaml

CircleCI

Clippy

Cargo.toml が必須です。設定ファイルとして clippy.toml または .clippy.toml を指定できますが、ない場合にはデフォルトの設定が採用されます。

Clippy

Dotenv Linter

.env ではじまるファイル名に対して適用されます。 .env.local は有効ですが、 test.env には適用されません。

Dotenv Linter

Flake8

設定ファイル .flake8 が必須です。

Flake8

OpenGrep

以下の設定ファイルのいずれかが必要です。

  • opengrep.yml
  • opengrep.yaml
  • opengrep.config.yml
  • opengrep.config.yaml
  • semgrep.yml
  • semgrep.yaml
  • semgrep.config.yml
  • semgrep.config.yaml

OpenGrep

Oxlint

以下の設定ファイルのいずれかがあることと、 Biome が無効になっている必要があります。

  • .oxlintrc.json
  • oxlintrc.json
  • .oxlintrc
  • oxlint.json

Oxlint

PHPCS

設定ファイル phpcs.xml または phpcs.xml.dist が必須です。また、 レビューのプロフィールassertive になっていないといけません(デフォルトはchillです)。

profile: assertive

PHPCS

PHPStan

以下の設定ファイルのいずれかが必要です。

  • phpstan.neon
  • phpstan.neon.dist
  • phpstan.dist.neon

また、設定ファイルには paths パラメータが必要です。逆に bootstrapFile または bootstrapFiles があってはいけません。

PHPStan

PMD

ruleset.xml というファイルを配置するか、 .coderabbit.yaml にて reviews.tools.pmd.config_file にて設定ファイルのパスを指定する必要があります。

reviews:
  tools:
    pmd:
      config_file: "/path/to/config.xml"

PMD

Prisma Lint

以下の設定ファイルのいずれかが必要です。

  • .prismalintrc.json
  • .prismalintrc
  • .prismalintrc.js
  • .prismalintrc.yaml
  • .prismalintrc.yml
  • prismalint.config.js

Prisma Lint

Pylint

以下の設定ファイルのいずれかが必要です。

  • .pylintrc
  • pylintrc
  • .pylintrc.toml
  • pylintrc.toml

Pylint

Semgrep

以下の設定ファイルのいずれかが必要です。

  • semgrep.yml
  • semgrep.yaml
  • semgrep.config.yml
  • semgrep.config.yaml

または、 .coderabbit.yaml にて reviews.tools.semgrep.config_file にて設定ファイルのパスを指定する必要があります。

reviews:
  tools:
    semgrep:
      config_file: "/path/to/config.yaml"

Semgrep

Shopify CLI

.theme-check.yml または .theme-check.yaml という設定ファイルがプロジェクトルートに必要です。

Shopify CLI

smarty-lint

smartylint.js という設定ファイルが必要です。

smarty-lint

SQLFluff

以下の設定ファイルのいずれかが必要です。

  • setup.cfg
  • tox.ini
  • pep8.ini
  • .sqlfluff
  • pyproject.toml

または、 .coderabbit.yaml にて reviews.tools.sqlfluff.config_file にて設定ファイルのパスを指定する必要があります。

reviews:
  tools:
    sqlfluff:
      config_file: "/path/to/config.toml"

SQLFluff

まとめ

Linterは便利ですが、チームにフィットさせるためには設定が欠かせません。他のLintツールについてもオプションで設定が指定できますので、ぜひ利用しているプロジェクトに合わせた設定を行ってください。

CodeRabbit Documentation - AI code reviews on pull requests, IDE, and CLI

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?