Skip to content

ci: Add config file for CodeRabbit with custom rules#622

Merged
spetrosi merged 1 commit into
mainfrom
coderabbit-init
May 19, 2026
Merged

ci: Add config file for CodeRabbit with custom rules#622
spetrosi merged 1 commit into
mainfrom
coderabbit-init

Conversation

@spetrosi
Copy link
Copy Markdown
Contributor

@spetrosi spetrosi commented May 19, 2026

Sourcery that we currently use cannot read documentation files and best
practices, it's rather a refactoring tool.
So I want to introduce CodeRabbit that allows creating .coderabbit.yaml with
custom rules and conventions.

Signed-off-by: Sergei Petrosian spetrosi@redhat.com

Summary by Sourcery

CI:

  • Configure CodeRabbit reviews to align with repository standards, enforce PR title/description formats, and provide path-specific review instructions for Ansible roles, tests, templates, variables, Python code, and documentation.

Sourcery that we currently use cannot read documentation files and best
practices, it's rather a refactoring tool.
So I want to introduce CodeRabbit that allows creating .coderabbit.yaml with
custom rules and conventions.

Signed-off-by: Sergei Petrosian <spetrosi@redhat.com>
@spetrosi spetrosi self-assigned this May 19, 2026
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented May 19, 2026

Reviewer's Guide

Adds a new .coderabbit.yaml configuration file to integrate CodeRabbit code review tooling with the repository, encoding project-specific review conventions, PR validation rules, and path-based review instructions for Ansible tasks, tests, templates, variables, Python code, and documentation.

File-Level Changes

Change Details Files
Introduce CodeRabbit review configuration with project-specific behavior and disabled nonessential features.
  • Create .coderabbit.yaml with schema reference and note that it is centrally managed from the linux-system-roles/.github repository
  • Configure chat and review settings to disable fun, auto, and finishing-touch features such as poems, fortunes, auto-labels, auto-assign, and automatic unit test checks
  • Disable additional review helpers like sequence diagrams, effort estimation, suggested labels, and high-level summaries
.coderabbit.yaml
Enforce repository PR title and description conventions through CodeRabbit pre-merge checks.
  • Configure PR title checks in warning mode to require Conventional Commits style titles, referencing the type-enum in .commitlintrc.js
  • Add a custom description-format check in warning mode requiring Enhancement/Feature, Reason, Result, and optional Issue Tracker sections matching the PR template
.coderabbit.yaml
Define path-based CodeRabbit instructions to encode Ansible role implementation and testing standards.
  • Add detailed guidance for tasks//*.yml on no_log usage, package installation with OSTree compatibility, idempotency, check-mode support, and test coverage requirements
  • Specify handlers//.yml rules to use storage_secure_logging with no_log for sensitive data
  • Define tests/tests_.yml rules requiring the wrapper include_tasks pattern, idempotent tests, assertions, and cleanup
  • Add templates//*.j2 rules requiring ansible_managed header and storage role fingerprint in the correct order
  • Configure defaults//.yml and vars/**/.yml conventions for variable prefixes, locations, and documentation requirements
.coderabbit.yaml
Add language- and file-type-specific review rules for Python code and README documentation.
  • Specify that all Python files must follow PEP 8, be formatted with Black, and be validated via tox -e black,flake8
  • Require README.md to document new user-facing variables and include usage examples for new functionality
.coderabbit.yaml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • The path-specific instructions are heavily tailored to the storage role (e.g., storage_secure_logging, storage_/__storage_ prefixes, system_role:storage fingerprint), which may not generalize cleanly if this shared configuration is applied to other linux-system-roles; consider parameterizing role-specific names or scoping this config only to the storage role.
  • Several instructions reference repository-level files and conventions (e.g., .commitlintrc.js, .github/pull_request_template.md, tests/run_role_with_clear_facts.yml wrapper) – double-check that these exist and are consistent in all target repositories where this shared .coderabbit.yaml will be used to avoid misleading AI review feedback.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The path-specific instructions are heavily tailored to the `storage` role (e.g., `storage_secure_logging`, `storage_`/`__storage_` prefixes, `system_role:storage` fingerprint), which may not generalize cleanly if this shared configuration is applied to other linux-system-roles; consider parameterizing role-specific names or scoping this config only to the storage role.
- Several instructions reference repository-level files and conventions (e.g., `.commitlintrc.js`, `.github/pull_request_template.md`, `tests/run_role_with_clear_facts.yml` wrapper) – double-check that these exist and are consistent in all target repositories where this shared `.coderabbit.yaml` will be used to avoid misleading AI review feedback.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@spetrosi spetrosi merged commit a50d60c into main May 19, 2026
46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant