Skip to content

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

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

ci: Add config file for CodeRabbit with custom rules#222
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

Introduce a CodeRabbit configuration file to standardize automated code review behavior and enforce project-specific contribution conventions.

CI:

  • Configure CodeRabbit review settings, disabling nonessential features and enabling pre-merge checks for PR titles and descriptions.

Documentation:

  • Encode project contribution guidelines and Ansible role conventions into automated review instructions for tasks, handlers, tests, templates, variables, Python code, and README usage 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 configuration file to standardize automated code review behavior and enforce linux-system-roles conventions, PR metadata requirements, and path-specific review instructions for Ansible, tests, templates, variables, Python, and docs.

File-Level Changes

Change Details Files
Introduce CodeRabbit configuration with review behavior, metadata checks, and disabled non-essential features.
  • Configure global chat and review behavior, disabling fun and auto features such as poems, fortunes, automatic labels/assignees, and additional analysis features.
  • Disable finishing touches like unit-test suggestions and limit CodeRabbit to core review functionality.
.coderabbit.yaml
Enforce PR title and description structure via pre-merge checks.
  • Add a warning-mode check that validates PR titles follow Conventional Commits syntax and allowed types from .commitlintrc.js.
  • Add a custom warning-mode check that validates PR descriptions follow the project’s pull request template sections (Enhancement/Feature, Reason, Result, optional Issue Tracker Tickets).
.coderabbit.yaml
Define path-specific review instructions reflecting linux-system-roles best practices for Ansible tasks, handlers, tests, templates, variables, Python code, and docs.
  • Add detailed Ansible tasks guidance covering no_log usage, OSTree-compatible package installation, third-party collections avoidance, role referencing, idempotency, check-mode support, and required test coverage for new tasks.
  • Add instructions for handlers to apply tlog_secure_logging to sensitive data, and for tests to use the central include_tasks wrapper and ensure idempotent, assert-based verification.
  • Require specific headers for Jinja2 templates, prefixes and locations for defaults/ and vars/ variables, Python style checks via Black/flake8, and README documentation for all new user-facing variables.
.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 reviewed your changes and they look great!


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 3fdf872 into main May 19, 2026
31 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