ci: Add config file for CodeRabbit with custom rules#242
Conversation
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>
Reviewer's GuideAdds a CodeRabbit configuration file to enforce repository-specific PR conventions and give CodeRabbit detailed, path-based review instructions for Ansible roles, tests, templates, variables, Python code, and documentation, while disabling non-essential CodeRabbit features. Sequence diagram for CodeRabbit review flow using .coderabbit.yamlsequenceDiagram
title CodeRabbit review sequence using .coderabbit_yaml
actor Developer
participant GitHub
participant CodeRabbit
participant CodeRabbitConfig
Developer->>GitHub: push code
GitHub->>CodeRabbit: trigger review
CodeRabbit->>CodeRabbitConfig: read config
CodeRabbitConfig-->>CodeRabbit: return config
CodeRabbit-->>GitHub: post review
GitHub-->>Developer: show review
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
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="191-195" />
<code_context>
+ # ========================================
+ # Templates
+ # ========================================
+ - path: "templates/**/*.j2"
+ instructions: |
+ **Required headers (in this order):**
+ 1. ansible_managed header: `{{ ansible_managed | comment }}`
+ 2. Role fingerprint: `{{ "system_role:ssh" | comment(prefix="", postfix="") }}`
+
+ # ========================================
</code_context>
<issue_to_address>
**issue (bug_risk):** Hard-coded `system_role:ssh` fingerprint may be incorrect for non-ssh roles using this shared config.
Because this config is shared for `linux-system-roles`, using `system_role:ssh` here will generate the wrong fingerprint for any non-ssh role that uses it. Please either make the role name configurable (if templating is supported in per-repo overrides) or move the fingerprint header into per-role overrides so each role can define its own `system_role:<role_name>` value.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| - path: "templates/**/*.j2" | ||
| instructions: | | ||
| **Required headers (in this order):** | ||
| 1. ansible_managed header: `{{ ansible_managed | comment }}` | ||
| 2. Role fingerprint: `{{ "system_role:ssh" | comment(prefix="", postfix="") }}` |
There was a problem hiding this comment.
issue (bug_risk): Hard-coded system_role:ssh fingerprint may be incorrect for non-ssh roles using this shared config.
Because this config is shared for linux-system-roles, using system_role:ssh here will generate the wrong fingerprint for any non-ssh role that uses it. Please either make the role name configurable (if templating is supported in per-repo overrides) or move the fingerprint header into per-role overrides so each role can define its own system_role:<role_name> value.
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 review rules and conventions.
CI:
Documentation:
Chores: