Skip to content

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

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

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

Conversation

@spetrosi
Copy link
Copy Markdown
Collaborator

@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

Add a CodeRabbit configuration file to standardize automated PR reviews and enforce project-specific conventions for this repository.

CI:

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

Documentation:

  • Document role- and project-specific conventions for tasks, handlers, tests, templates, variables, Python code, and README usage within the CodeRabbit configuration to guide review feedback.

Chores:

  • Align repository with shared linux-system-roles CodeRabbit configuration managed from the central .github repository.

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 review from richm and rjeffman as code owners 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 repository-wide CodeRabbit configuration (.coderabbit.yaml) that encodes linux-system-roles conventions, disables non-essential CodeRabbit features, and defines path-specific review rules for Ansible tasks, tests, templates, variables, Python code, and documentation.

Flow diagram for CodeRabbit review using .coderabbit.yaml

flowchart TD
  A[GitHub_PR_opened] --> B[CodeRabbit_reviews]
  B --> C[Load_coderabbit_yaml]

  C --> D[Apply_pre_merge_checks]
  D --> D1[Check_PR_title_format]
  D --> D2[Check_PR_description_template]

  C --> E[Apply_path_instructions]
  E --> E1[Review_tasks_yml_rules]
  E --> E2[Review_tests_yml_rules]
  E --> E3[Review_templates_j2_rules]
  E --> E4[Review_defaults_vars_yml_rules]
  E --> E5[Review_python_files_rules]
  E --> E6[Review_README_md_rules]

  C --> F[Disable_nonessential_features]
  F --> F1[Disable_auto_labels_and_reviewers]
  F --> F2[Disable_sequence_diagrams_and_summaries]
  F --> F3[Disable_finishing_touches_unit_tests]

  D1 --> G[Emit_warnings_if_violations]
  D2 --> G
  E1 --> G
  E2 --> G
  E3 --> G
  E4 --> G
  E5 --> G
  E6 --> G

  G --> H[Post_review_comments_on_PR]
Loading

File-Level Changes

Change Details Files
Introduce CodeRabbit configuration file with custom review workflow, PR validation rules, and path-specific Ansible role conventions.
  • Create .coderabbit.yaml with basic chat and review feature toggles, disabling fun and auto-management behaviors.
  • Define pre-merge checks enforcing Conventional Commit-style PR titles and a structured PR description template.
  • Add path_instructions blocks that encode detailed guidelines for Ansible tasks, handlers, tests, templates, defaults/vars layout, Python formatting, and README documentation expectations.
.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 found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path=".coderabbit.yaml" line_range="203-204" />
<code_context>
+        - All variables MUST be stored in the file defaults/main.yml, Ansible
+          doesn't include variables from other files.
+        - These are user-facing API variables
+        - For every new variable introduced in this file, verify that it is
+          documented in README.md with a description and a usage example.
+          If it is missing from README.md, flag it and request that it be added.
+
</code_context>
<issue_to_address>
**suggestion:** Clarify scope of the statement about Ansible not including variables from other files.

The phrase `Ansible doesn't include variables from other files.` is accurate for role defaults (only `defaults/main.yml` is auto-loaded) but can be misread as a general rule about all Ansible variables. Please narrow it to something like `Ansible only auto-loads role defaults from defaults/main.yml` to avoid confusion with mechanisms like `include_vars`.

```suggestion
        - All variables MUST be stored in the file defaults/main.yml, Ansible
          only auto-loads role defaults from defaults/main.yml and does not
          automatically include variables from other files.
```
</issue_to_address>

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.

Comment thread .coderabbit.yaml
Comment on lines +203 to +204
- All variables MUST be stored in the file defaults/main.yml, Ansible
doesn't include variables from other files.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion: Clarify scope of the statement about Ansible not including variables from other files.

The phrase Ansible doesn't include variables from other files. is accurate for role defaults (only defaults/main.yml is auto-loaded) but can be misread as a general rule about all Ansible variables. Please narrow it to something like Ansible only auto-loads role defaults from defaults/main.yml to avoid confusion with mechanisms like include_vars.

Suggested change
- All variables MUST be stored in the file defaults/main.yml, Ansible
doesn't include variables from other files.
- All variables MUST be stored in the file defaults/main.yml, Ansible
only auto-loads role defaults from defaults/main.yml and does not
automatically include variables from other files.

@spetrosi spetrosi merged commit 9fe3253 into main May 19, 2026
39 of 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