Skip to content

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

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

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

Chores:

  • Introduce .coderabbit.yaml with centralized review rules aligned with linux-system-roles contributor conventions.

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
Copy link
Copy Markdown

sourcery-ai Bot commented May 19, 2026

Reviewer's Guide

Adds a centralized CodeRabbit configuration file (.coderabbit.yaml) to enforce linux-system-roles contribution conventions and customize automated review behavior for this repository, including PR metadata checks and path-specific review instructions for Ansible tasks, tests, templates, variables, Python, and documentation.

Flow diagram for CodeRabbit PR review with .coderabbit.yaml

flowchart TD
    Developer[Developer opens PR] --> GitHub[GitHub PR]
    GitHub --> CodeRabbit[CodeRabbit review bot]

    CodeRabbit --> Config[Load .coderabbit.yaml]

    Config --> PreMergeChecks[Apply pre_merge_checks]
    PreMergeChecks --> TitleCheck[Validate PR title format]
    PreMergeChecks --> DescriptionCheck[Check description template]

    Config --> PathInstructions[Apply path_instructions]
    PathInstructions --> AnsibleTasks[tasks/**/*.yml rules]
    PathInstructions --> Tests[tests/tests_*.yml rules]
    PathInstructions --> Templates[templates/**/*.j2 rules]
    PathInstructions --> Defaults[defaults/**/*.yml rules]
    PathInstructions --> Vars[vars/**/*.yml rules]
    PathInstructions --> Python[**/*.py rules]
    PathInstructions --> Docs[README.md rules]

    CodeRabbit --> ReviewOutput[Post review comments with warnings]
    ReviewOutput --> Developer
Loading

File-Level Changes

Change Details Files
Introduce repository-wide CodeRabbit configuration to align automated reviews with linux-system-roles standards and disable non-essential features.
  • Create .coderabbit.yaml with project-level chat and review behavior settings, turning off fun and auto-features such as poems, fortunes, auto labels, and auto reviewer assignment.
  • Configure pre-merge checks to validate PR titles against Conventional Commits rules and encourage structured PR descriptions following the shared template.
  • Define path-specific instructions for Ansible tasks, handlers, tests, templates, defaults/vars, Python files, and README.md to guide CodeRabbit’s feedback in line with existing best practices (security, OSTree compatibility, idempotency, test coverage, and documentation).
.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:

  • Several instructions are hard-coded to the example "template" role (e.g., template_ / __template_ prefixes, system_role:template fingerprint, template_secure_logging, __template_packages, __template_is_ostree), which may not align with other linux-system-roles; consider parameterizing or generalizing this config so it applies correctly across different roles.
  • The rules reference specific files and paths like .commitlintrc.js, .github/pull_request_template.md, vars/main.yml, defaults/main.yml, tasks/run_role_with_clear_facts.yml, and tests/tests_*.yml; please double-check that these exist or are consistently named in all repositories where this centralized .coderabbit.yaml will be used to avoid false warnings.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Several instructions are hard-coded to the example "template" role (e.g., `template_` / `__template_` prefixes, `system_role:template` fingerprint, `template_secure_logging`, `__template_packages`, `__template_is_ostree`), which may not align with other linux-system-roles; consider parameterizing or generalizing this config so it applies correctly across different roles.
- The rules reference specific files and paths like `.commitlintrc.js`, `.github/pull_request_template.md`, `vars/main.yml`, `defaults/main.yml`, `tasks/run_role_with_clear_facts.yml`, and `tests/tests_*.yml`; please double-check that these exist or are consistently named in all repositories where this centralized `.coderabbit.yaml` will be used to avoid false warnings.

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 a9a2e25 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