-
Notifications
You must be signed in to change notification settings - Fork 223
NO-ISSUE: Add CodeRabbit config with review rules from PR analysis #1360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dgoodwin
wants to merge
2
commits into
main
Choose a base branch
from
add-auto-generated-coderabbit-rules
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| inheritance: true | ||
| language: en-US | ||
| early_access: false | ||
| reviews: | ||
| path_filters: | ||
| - "!vendor/**" | ||
| - "!go.sum" | ||
| profile: chill | ||
| request_changes_workflow: false | ||
| high_level_summary: true | ||
| poem: false | ||
| review_status: true | ||
| collapse_walkthrough: false | ||
| path_instructions: | ||
| - path: "install/**prometheusrule*" | ||
| instructions: | | ||
| PrometheusRule alert expressions should: | ||
| - Use `last_over_time(metric{...}[5m])` to prevent failed scrapes from | ||
| resetting alerts | ||
| - Prefer `!= 0` for alert expressions where 0 is the happy case | ||
| - Use singular metric names (e.g., `_condition` not `_conditions`) per | ||
| kube-state-metrics conventions | ||
| - Ensure the `for` duration is appropriate for the alert severity | ||
| - Verify runbook URLs point to the correct component (not another operator) | ||
| - Include a meaningful description and summary annotation | ||
| - path: "install/**" | ||
| instructions: | | ||
| Manifest file and resource naming conventions: | ||
| - Resource names should use the full component name (e.g., | ||
| `cluster-version-operator`) not acronyms (e.g., `cvo`) and should not | ||
| echo the Kind (e.g., no `-sa` suffix for ServiceAccounts) | ||
| - File numbering should leave gaps for future additions; avoid `ZZ` or | ||
| letter suffixes for ordering — renumber sibling files instead | ||
| - All manifests must have appropriate cluster-profile annotations | ||
| (include.release.openshift.io/self-managed-high-availability, etc.) | ||
| - Use kubernetes.io/description annotations to explain the resource's purpose | ||
| - When adding new manifests, ensure the run-level ordering is correct | ||
| (e.g., ServiceAccounts before RoleBindings that reference them) | ||
| - path: "pkg/**/*.go" | ||
| instructions: | | ||
| In reconciliation and controller code, state mutations (struct field | ||
| assignments, status updates) should happen as close as possible to where | ||
| the value is consumed. Avoid setting fields early in a function when they | ||
| are used much later — this creates risk of inconsistency if future code | ||
| adds early returns or error paths between the mutation and use. | ||
|
|
||
| When sorting or deduplicating collections, ensure stable ordering by | ||
| including a tiebreaker field (e.g., sort by version then by name). | ||
|
|
||
| When the same boolean condition is used for both logging and a | ||
| return/branch decision, extract it to a named variable to keep logic | ||
| coupled and avoid divergence if one usage is updated but not the other. | ||
|
|
||
| When modifying code, check that nearby comments, | ||
| kubernetes.io/description annotations, and doc strings still accurately | ||
| describe the new behavior. Outdated documentation is worse than no | ||
| documentation. | ||
| - path: "pkg/cvo/updatepayload.go" | ||
| instructions: | | ||
| When modifying container security contexts, ensure init containers are | ||
| also reviewed. All containers should have `readOnlyRootFilesystem: true` | ||
| unless they explicitly need to write to the filesystem. If an init | ||
| container needs write access, document why in the commit message and | ||
| consider using `cp` instead of `mv` to keep the source read-only. | ||
| - path: "**/*_test.go" | ||
| instructions: | | ||
| Test code conventions: | ||
| - Prefer table-driven tests over multiple similar test functions. If two | ||
| test functions differ only in setup values, collapse them into one | ||
| function with test-case tuples | ||
| - Don't re-fetch resources already obtained in BeforeEach/setup | ||
| - Don't introduce single-use variables just to name an intermediate | ||
| value; use the expression directly unless it aids readability | ||
| - When adding new e2e tests, run `make update` to regenerate | ||
| .openshift-tests-extension metadata — CI verify-update will fail | ||
| otherwise | ||
| - path: "test/**/*.go" | ||
| instructions: | | ||
| E2E test conventions: | ||
| - Add comments explaining non-obvious test URLs or external endpoints | ||
| - Use Ginkgo Labels to mark test categories (e.g., TechPreview, serial) | ||
| - When skipping tests for certain environments, document the reason | ||
| - Ensure test names follow the | ||
| `[Jira:"Cluster Version Operator"] description` format | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Jira test-name format does not match the PR objective. This says Proposed fix- - Ensure test names follow the
- `[Jira:"Cluster Version Operator"] description` format
+ - Ensure test names follow the
+ `[Jira:"CVO"] description` format🤖 Prompt for AI Agents |
||
| tools: | ||
| shellcheck: | ||
| enabled: true | ||
| markdownlint: | ||
| enabled: true | ||
| auto_review: | ||
| enabled: true | ||
| drafts: true | ||
| chat: | ||
| auto_reply: true | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: openshift/cluster-version-operator
Length of output: 1616
🌐 Web query:
CodeRabbit path_instructions glob pattern syntax documentation💡 Result:
CodeRabbit's path_instructions feature uses glob patterns to apply custom review instructions to specific file paths or directories in the .coderabbit.yaml configuration file. Paths accept glob patterns following the minimatch library syntax. Configuration example: reviews: path_instructions: - path: "src/controllers/" instructions: | - Focus on authentication, authorization, and input validation. - Flag any direct database queries that bypass the ORM layer. - path: "tests/" instructions: | Review the following unit test code written using the Mocha test library. Ensure that: - The code adheres to best practices associated with Mocha. - Descriptive test names are used to clearly convey the intent of each test. - Edge cases and error paths are covered. - path: "docs/.md" instructions: | Check for clarity, accuracy, and completeness. This can also be configured via the Web UI in Organization Settings → Reviews → Behavior. Glob Pattern Syntax (via minimatch): - Use forward slashes (/) as path separators, even on Windows. - * : matches zero or more characters in a path segment. - : matches any number of path segments (directories), including none. - ? : matches one character. - {a,b} : brace expansion, matches 'a' or 'b'. - [abc] : character class, matches a, b, or c. - [!abc] or [a-z] : negated or range. - Patterns starting with ! are for exclusion in path_filters, but path_instructions uses positive matching. - # at start is a comment. For full minimatch documentation, see https://isaacs.github.io/minimatch/. Examples from docs: - "/.ts" for TypeScript files. - "src/api/" for API directory. - "tests/." for all test files. Instructions max length: 20000 characters per entry.
Citations:
🏁 Script executed:
Repository: openshift/cluster-version-operator
Length of output: 870
PrometheusRule path glob does not follow minimatch syntax properly.
The pattern
install/**prometheusrule*is malformed. Per CodeRabbit's minimatch glob syntax,**must be followed by/when used to match directory levels. Use an explicit recursive segment form to correctly target files.Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents