forked from opensearch-project/sql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.coderabbit.yaml
More file actions
189 lines (164 loc) · 7.82 KB
/
.coderabbit.yaml
File metadata and controls
189 lines (164 loc) · 7.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
# CodeRabbit Configuration for OpenSearch SQL Project
# This configuration uses .rules/REVIEW_GUIDELINES.md for code review standards
language: "en-US"
early_access: false
reviews:
profile: "chill"
request_changes_workflow: false
high_level_summary: true
high_level_summary_in_walkthrough: true
poem: false # Keep reviews professional and concise
review_status: true
collapse_walkthrough: true
auto_review:
enabled: true
auto_incremental_review: true
drafts: false # Don't review draft PRs
ignore_title_keywords:
- "WIP"
- "DO NOT MERGE"
- "DRAFT"
# General review instructions (applied to all reviews)
instructions:
# Architectural Decision Prompts
- "For new features: Check if similar functionality exists that could be enhanced instead"
- "Question whether new code is needed vs reusing/extending existing code"
- "Identify opportunities for code reuse across the codebase"
# Path-specific review instructions
path_instructions:
# Grammar Files - Architectural Decision Prompts
- path: "**/*.g4"
instructions: |
- Check if modifying unrelated grammar files (scope creep)
- Verify grammar rule placement follows project patterns
- Question if new rule needed vs reusing existing rules
- Ensure changes are relevant to the PR's stated purpose
- path: "ppl/src/main/antlr/OpenSearchPPLParser.g4"
instructions: |
- Identify code reuse opportunities with existing commands
- Validate command follows PPL naming and structure patterns
- Check if command should be alias vs separate implementation
# Java Files - Code Organization and Quality
- path: "**/*.java"
instructions: |
- Flag methods >50 lines as potentially too complex - suggest refactoring
- Flag classes >500 lines as needing organization review
- Check for dead code, unused imports, and unused variables
- Identify code reuse opportunities across similar implementations
- Assess holistic maintainability - is code easy to understand and modify?
- Flag code that appears AI-generated without sufficient human review
- Verify Java naming conventions (PascalCase for classes, camelCase for methods/variables)
- Check for proper JavaDoc on public classes and methods
- Flag redundant comments that restate obvious code
- Ensure proper error handling with specific exception types
- Check for Optional<T> usage instead of null returns
- Validate proper use of try-with-resources for resource management
# Core Java - Project-Specific Patterns
- path: "core/src/main/java/**/*.java"
instructions: |
- New functions MUST have unit tests in the same commit
- Public methods MUST have JavaDoc with @param, @return, and @throws
- Follow existing function implementation patterns in the same package
- New expression functions should follow ExpressionFunction interface patterns
- Validate function naming follows project conventions (camelCase)
- path: "core/src/main/java/org/opensearch/sql/expression/**/*.java"
instructions: |
- New expression implementations must follow existing patterns
- Type handling must be consistent with project type system
- Error handling must use appropriate exception types
- Null handling must be explicit and documented
- path: "core/src/main/java/org/opensearch/sql/ast/**/*.java"
instructions: |
- AST nodes must be immutable where possible
- Follow visitor pattern for AST traversal
- Ensure proper toString() implementation for debugging
# Test Files - Enhanced Coverage Validation
- path: "**/test/**/*.java"
instructions: |
- Verify NULL input tests for all new functions
- Check boundary condition tests (min/max values, empty inputs)
- Validate error condition tests (invalid inputs, exceptions)
- Ensure multi-document tests for per-document operations
- Flag smoke tests without meaningful assertions
- Check test naming follows pattern: test<Functionality><Condition>
- Verify test data is realistic and covers edge cases
- Verify test coverage for new business logic
- Ensure tests are independent and don't rely on execution order
- Validate meaningful test data that reflects real-world scenarios
- Check for proper cleanup of test resources
# Integration Tests
- path: "integ-test/**/*IT.java"
instructions: |
- Integration tests MUST use valid test data from resources
- Verify test data files exist in integ-test/src/test/resources/
- Check test assertions are meaningful and specific
- Validate tests clean up resources after execution
- Ensure tests are independent and can run in any order
- Flag tests that reference non-existent indices (e.g., EMP)
- Verify integration tests are in correct module (integ-test/)
- Check tests can be run with ./gradlew :integ-test:integTest
- Ensure proper test data setup and teardown
- Validate end-to-end scenario coverage
- path: "integ-test/src/test/resources/**/*"
instructions: |
- Verify test data is realistic and representative
- Check data format matches expected schema
- Ensure test data covers edge cases and boundary conditions
# PPL-specific
- path: "**/ppl/**/*.java"
instructions: |
- For PPL parser changes, verify grammar tests with positive/negative cases
- Check AST generation for new syntax
- Ensure corresponding AST builder classes are updated
- Validate edge cases and boundary conditions
# Calcite Integration
- path: "**/calcite/**/*.java"
instructions: |
- Follow existing Calcite integration patterns
- Verify RelNode visitor implementations are complete
- Check RexNode handling follows project conventions
- Validate SQL generation is correct and optimized
- Ensure Calcite version compatibility
- Follow existing patterns in CalciteRelNodeVisitor and CalciteRexNodeVisitor
- Document any Calcite-specific workarounds
- Test compatibility with Calcite version constraints
- path: "core/src/main/java/org/opensearch/sql/calcite/CalciteRelNodeVisitor.java"
instructions: |
- Flag methods >50 lines - this file is known to be hard to read
- Suggest extracting complex logic into helper methods
- Check for code organization and logical grouping
- Validate all RelNode types are handled
# Documentation
- path: "docs/**/*.rst"
instructions: |
- Verify examples use valid test data and indices
- Check documentation follows existing patterns and structure
- Validate syntax examples are complete and correct
- Ensure code examples are tested and working
- Check for consistent formatting and style
chat:
auto_reply: false # require explicit tagging
art: false # disable ASCII / Emoji art
# Knowledge base configuration
knowledge_base:
# Don't opt out - use knowledge base features
opt_out: false
# Code guidelines - reference our custom review guidelines
code_guidelines:
enabled: true
filePatterns:
# Reference our custom review guidelines
- ".rules/REVIEW_GUIDELINES.md"
# Enable web search for additional context
web_search:
enabled: true
# Use repository-specific learnings for this project
learnings:
scope: "local"
# Use repository-specific issues
issues:
scope: "local"
# Use repository-specific pull requests for context
pull_requests:
scope: "local"