Skip to content

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

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

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

Conversation

@spetrosi

@spetrosi spetrosi commented May 19, 2026

Copy link
Copy Markdown
Contributor

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

Configure CodeRabbit for this repository with project-specific review rules and conventions.

Enhancements:

  • Encode best practices for Ansible tasks, handlers, tests, templates, variables, and Python code into CodeRabbit path-specific review instructions.

CI:

  • Add .coderabbit.yaml to define CodeRabbit review behavior, disabled extras, and pre-merge checks for PR titles and descriptions.

Documentation:

  • Document expectations for PR descriptions and README coverage of new variables within the CodeRabbit configuration.

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 requested a review from richm as a code owner May 19, 2026 08:40
@spetrosi spetrosi self-assigned this May 19, 2026
@sourcery-ai

sourcery-ai Bot commented May 19, 2026

Copy link
Copy Markdown

Reviewer's Guide

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

File-Level Changes

Change Details Files
Introduce CodeRabbit configuration file with global review and chat settings, disabling nonessential or cosmetic features.
  • Add yaml-language-server schema reference comment for CodeRabbit config validation.
  • Disable artwork in chat responses.
  • Disable poem generation, in-progress fortune messages, and various automatic review features such as auto labels, auto reviewer assignment, and request-changes workflow.
  • Turn off ancillary review features including sequence diagrams, effort estimation, suggested labels, and high-level summaries in walkthroughs.
  • Disable unit-test finishing-touches automation.
.coderabbit.yaml
Define PR title and description quality checks aligned with existing contribution and commit conventions.
  • Configure a pre_merge_checks.title rule that warns when PR titles do not follow Conventional Commits format, referencing the type-enum rule from .commitlintrc.js.
  • Add a custom description-format check that enforces adherence to the PR description template in .github/pull_request_template.md with required Enhancement/Feature, Reason, and Result sections, plus optional issue tracker section.
  • Include inline examples illustrating compliant PR titles and descriptions for reviewers and CodeRabbit.
.coderabbit.yaml
Add path-based review instructions tailored to this role’s Ansible tasks, handlers, tests, templates, defaults, vars, Python code, and README documentation.
  • Specify detailed guidelines for tasks files, including parametrized no_log patterns, OSTree-compatible package installation with ansible.builtin.package, avoidance of third-party collections, idempotency, check-mode support, and mandatory test coverage for new tasks.
  • Add handler rules requiring no_log to use the systemd_secure_logging variable.
  • Define strict test playbook patterns enforcing use of the central run_role_with_clear_facts wrapper instead of include_role/import_role/roles, and expectations for assert-based, idempotent tests with cleanup.
  • Require Jinja2 templates to include ansible_managed and a role fingerprint header in a specific order.
  • Enforce naming and placement conventions for defaults (systemd_) and vars (_systemd) files, including documentation requirements in README for all new user-facing variables.
  • Set expectations for Python code formatting (PEP 8, Black, tox -e black,flake8) and for README.md updates documenting new variables and usage examples.
.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

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

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 7d17721 into main May 19, 2026
40 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