Skip to content

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

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

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

Add a CodeRabbit configuration file to enforce repository-specific PR conventions and review guidelines.

CI:

  • Configure CodeRabbit review settings, disabling nonessential features and enabling checks for PR title and description format.

Documentation:

  • Document role- and repository-specific conventions for tasks, handlers, tests, templates, variables, Python code, and README updates via CodeRabbit path instructions.

Chores:

  • Centralize project best practices and coding conventions in a managed .coderabbit.yaml file synced from the shared .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 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 project-wide CodeRabbit configuration file to enforce PR formatting and Ansible/linux-system-roles conventions during automated code review, while disabling most non-essential CodeRabbit features.

File-Level Changes

Change Details Files
Introduce CodeRabbit configuration file with organization-wide review rules and path-specific Ansible conventions.
  • Create .coderabbit.yaml to configure CodeRabbit behavior for this repository, disabling fun/auto features and enabling pre-merge checks for PR titles and descriptions.
  • Define custom instructions for reviewing Ansible tasks, handlers, tests, templates, defaults/vars, and Python code, including no_log usage, OSTree-safe package installation, idempotency, check-mode expectations, and test coverage requirements.
  • Require documentation updates in README.md for new user-facing variables and specify conventions for variable naming and template headers.
.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 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="202-205" />
<code_context>
+    - path: "defaults/**/*.yml"
+      instructions: |
+        - All variables MUST be prefixed with `keylime_server_`
+        - 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
</code_context>
<issue_to_address>
**suggestion:** Wording about Ansible defaults loading behavior is misleading and may confuse contributors.

"Ansible doesn't include variables from other files" is inaccurate: Ansible loads all files under `defaults/` as role defaults. If this is a project convention (using only `defaults/main.yml`), please phrase it as a policy rather than a tool limitation, e.g., "All variables MUST be stored in `defaults/main.yml`; other files under `defaults/` MUST NOT be used in this role."

```suggestion
        - All variables MUST be prefixed with `keylime_server_`
        - All variables MUST be stored in `defaults/main.yml`; other files under
          `defaults/` MUST NOT be used for variable definitions in this role.
        - These are user-facing API variables
```
</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 +202 to +205
- All variables MUST be prefixed with `keylime_server_`
- 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

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: Wording about Ansible defaults loading behavior is misleading and may confuse contributors.

"Ansible doesn't include variables from other files" is inaccurate: Ansible loads all files under defaults/ as role defaults. If this is a project convention (using only defaults/main.yml), please phrase it as a policy rather than a tool limitation, e.g., "All variables MUST be stored in defaults/main.yml; other files under defaults/ MUST NOT be used in this role."

Suggested change
- All variables MUST be prefixed with `keylime_server_`
- 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
- All variables MUST be prefixed with `keylime_server_`
- All variables MUST be stored in `defaults/main.yml`; other files under
`defaults/` MUST NOT be used for variable definitions in this role.
- These are user-facing API variables

@spetrosi spetrosi merged commit 7729f94 into main May 19, 2026
39 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