-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.coderabbit.yaml
More file actions
291 lines (291 loc) · 19.4 KB
/
.coderabbit.yaml
File metadata and controls
291 lines (291 loc) · 19.4 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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
language: en-US
tone_instructions: "Memory-safe libmagic alternative in idiomatic Rust. Zero unsafe code, comprehensive error handling, Result-based APIs. Safety over performance, library reusability, modern Rust patterns."
early_access: true
enable_free_tier: true
reviews:
profile: assertive
request_changes_workflow: true
high_level_summary: true
high_level_summary_placeholder: "@coderabbitai summary"
high_level_summary_in_walkthrough: true
auto_title_placeholder: "@coderabbitai"
auto_title_instructions: "Generate PR/MR titles following Conventional Commits format: type(scope): description. Use types: feat, fix, docs, style, refactor, perf, test, build, ci, chore. Use scopes: parser, evaluator, io, output, cli, ast, grammar, types, operators, offsets, magic, file-type, performance, memory-safety, compatibility, testing, benchmarks, documentation. Keep descriptions concise and action-oriented, focusing on libmagic-rs functionality."
review_status: true
commit_status: true
fail_commit_status: false
collapse_walkthrough: false
changed_files_summary: true
sequence_diagrams: true
estimate_code_review_effort: true
assess_linked_issues: true
related_issues: true
related_prs: true
suggested_labels: true
auto_apply_labels: true
suggested_reviewers: true
auto_assign_reviewers: false
in_progress_fortune: true
poem: true
labeling_instructions:
- label: "parser"
instructions: "Apply when changes are made to src/parser/ directory, magic file parsing, grammar rules, or AST structures"
- label: "evaluator"
instructions: "Apply when changes are made to src/evaluator/ directory, rule evaluation logic, or offset resolution"
- label: "io"
instructions: "Apply when changes are made to src/io/ directory, file I/O operations, memory mapping, or FileBuffer"
- label: "output"
instructions: "Apply when changes are made to src/output/ directory, result formatting, or output generation"
- label: "cli"
instructions: "Apply when changes are made to src/main.rs, command-line interface, or CLI tools"
- label: "memory-safety"
instructions: "Apply when changes improve memory safety, add bounds checking, or remove unsafe code"
- label: "performance"
instructions: "Apply when changes involve performance optimizations, benchmarks, or speed improvements"
- label: "compatibility"
instructions: "Apply when changes involve libmagic compatibility features, migration tools, or API compatibility"
- label: "testing"
instructions: "Apply when changes involve test infrastructure, test coverage, or testing utilities"
- label: "rust"
instructions: "Apply when changes involve Rust language features, idioms, or modern Rust patterns"
path_filters:
[
"src/**",
"docs/src/**",
".kiro/**/*.md",
".cursor/**/*.mdc",
".github/**",
"!.github/workflows/release.yml",
"*.md",
"*.toml",
"*.yaml",
"*.yml",
"*.json",
"*.sh",
"justfile",
"build.rs",
"!target/**",
"!dist/**",
"!docs/book/**",
"!node_modules/**",
"!*.woff2",
"!*.png",
"!*.svg",
"!*.ico",
"!*.wxs",
"!third_party/**",
]
path_instructions:
- path: "src/lib.rs"
instructions: "Focus on public API design, core data structures (MagicRule, Value, TypeKind, Operator, OffsetSpec), and library interface. Ensure comprehensive rustdoc documentation with examples. Prioritize memory safety and idiomatic Rust patterns."
- path: "src/main.rs"
instructions: "Review CLI interface design, argument parsing with clap, error handling, and user experience. Ensure proper exit codes and help text. Focus on usability and cross-platform compatibility."
- path: "src/parser/**"
instructions: "Focus on magic file DSL parsing, AST node definitions, and grammar rules. Ensure comprehensive error handling for malformed input, proper escape sequence handling, and robust parsing logic. Include property tests for parser invariants."
- path: "src/parser/ast.rs"
instructions: "Review AST data structures matching the libmagic spec. Ensure proper serialization support, comprehensive documentation, and type safety. Focus on memory layout and performance characteristics."
- path: "src/parser/grammar/**"
instructions: "Review nom-based parsing logic, grammar rules, and parser combinators. Ensure robust parsing of magic file syntax, proper error recovery, and comprehensive test coverage for edge cases."
- path: "src/parser/codegen.rs"
instructions: "Review codegen serialization of AST types to Rust source. This module is shared by build.rs and build_helpers.rs. Ensure all TypeKind, Operator, and Value variants are serialized. Verify generated use-statement imports match."
- path: "src/parser/types.rs"
instructions: "Review type keyword parsing and TypeKind conversion. Ensure all libmagic type keywords are handled, case-insensitive matching is applied at entry points, and new types follow established patterns."
- path: "src/parser/loader.rs"
instructions: "Review magic file loading from disk. Ensure proper error handling for missing/invalid files, directory traversal safety, and resource limits."
- path: "src/evaluator/**"
instructions: "Focus on rule evaluation engine, offset resolution, type interpretation, and comparison operators. Ensure memory safety, bounds checking, and performance optimization. Include comprehensive error handling for malformed files."
- path: "src/evaluator/engine/**"
instructions: "Review the core evaluation loop. Focus on rule matching, recursion depth limits, timeout handling, and early exit optimization. Ensure no panics in library code."
- path: "src/evaluator/offset/**"
instructions: "Review offset resolution logic for absolute, indirect, and relative offsets. Ensure proper bounds checking, endianness handling, and performance optimization. Focus on memory safety and edge case handling."
- path: "src/evaluator/types/**"
instructions: "Review type interpretation logic for byte, short, long, quad, float, double, string, pstring, and date types with endianness support. Ensure proper bounds checking, overflow handling via checked_add, and no unwrap() in library code."
- path: "src/evaluator/operators/**"
instructions: "Review comparison and bitwise operators implementation. Ensure proper type coercion, overflow handling, and performance optimization. Focus on correctness, epsilon-aware float comparison, and edge case handling."
- path: "src/evaluator/strength.rs"
instructions: "Review strength calculation for rule ordering. Ensure all TypeKind and Operator variants are handled in match arms. Focus on correctness of strength modifiers."
- path: "src/output/**"
instructions: "Focus on output formatting for text and JSON formats. Ensure compatibility with GNU file command output, proper error handling, and structured metadata. Review performance for large result sets."
- path: "src/output/text.rs"
instructions: "Review human-readable output formatting. Ensure compatibility with GNU file command, proper text encoding, and performance optimization. Focus on user experience and readability."
- path: "src/output/json.rs"
instructions: "Review JSON structured output with metadata. Ensure proper serialization, schema consistency, and performance optimization. Focus on API usability and backward compatibility."
- path: "src/io/**"
instructions: "Focus on file I/O operations, memory mapping, and resource management. Ensure proper bounds checking, error handling, and RAII patterns. Prioritize memory safety and performance."
- path: "src/error.rs"
instructions: "Review error types and handling strategies. This file is shared with build.rs and cannot reference lib-only types. Ensure comprehensive error coverage, proper error propagation, and user-friendly error messages."
- path: "build.rs"
instructions: "Review build script that compiles magic rules at build time. Uses #[path] includes to share code with the library. Ensure rerun-if-changed directives are correct and generated code is valid."
- path: "tests/**"
instructions: "Review test coverage, test organization, and test quality. Prefer table-driven tests over one-assertion-per-function. Ensure comprehensive unit tests, integration tests, and property-based tests with proptest."
- path: "benches/**"
instructions: "Review benchmark design and performance testing. Ensure meaningful benchmarks, proper statistical analysis, and performance regression detection. Focus on critical path optimization."
- path: "docs/**"
instructions: "Review documentation quality, completeness, and accuracy. Ensure comprehensive API documentation, usage examples, and migration guides. Focus on user experience and developer onboarding."
- path: "Cargo.toml"
instructions: "Review dependency management, feature flags, and build configuration. Ensure proper version constraints, security considerations, and build optimization. Focus on dependency hygiene and performance."
- path: "justfile"
instructions: "Review build automation and development workflow. Ensure comprehensive task coverage, cross-platform compatibility, and developer experience. Focus on workflow efficiency and maintainability."
abort_on_close: true
disable_cache: false
auto_review:
enabled: true
auto_incremental_review: true
ignore_title_keywords: ["WIP", "draft", "do not merge"]
drafts: false
base_branches: ["main"]
ignore_usernames: ["dosubot", "dependabot"]
finishing_touches:
docstrings:
enabled: true
unit_tests:
enabled: false
pre_merge_checks:
docstrings:
mode: warning
threshold: 85
title:
mode: warning
requirements: "Must follow Conventional Commits specification: type(scope): description. Types: feat, fix, docs, style, refactor, perf, test, build, ci, chore. Scopes: parser, evaluator, io, output, cli, ast, grammar, types, operators, offsets, strength, codegen, loader, engine. Breaking changes indicated with ! in header or BREAKING CHANGE: in footer."
description:
mode: warning
issue_assessment:
mode: warning
custom_checks:
- name: "memory-safety-check"
instructions: "Verify no unsafe code blocks are introduced (except in vetted dependencies like memmap2, byteorder). All buffer access must use bounds checking with .get() methods. No raw pointer arithmetic or transmute operations."
- name: "libmagic-compatibility-check"
instructions: "Ensure changes maintain compatibility with libmagic behavior and magic file format. Magic file parsing must handle standard syntax correctly. Output format should match GNU file command expectations."
- name: "performance-regression-check"
instructions: "Check for potential performance regressions in critical paths (parser, evaluator, I/O). Memory-mapped I/O should be used for file access. Avoid unnecessary allocations in hot paths. Consider Aho-Corasick for multi-pattern searches."
- name: "test-coverage-check"
instructions: "Verify adequate test coverage for new functionality, especially edge cases and error conditions. Include property tests with proptest for complex data structures. Test malformed input handling and boundary conditions."
- name: "error-handling-check"
instructions: "Verify proper error handling with Result types and no panics in library code. All public APIs should return Result<T, E> for error conditions. Use thiserror for structured error types. No unwrap() or expect() in library code."
tools:
ast-grep:
rule_dirs: []
util_dirs: []
essential_rules: true
packages: []
shellcheck:
enabled: true
markdownlint:
enabled: true
github-checks:
enabled: true
timeout_ms: 120000
languagetool:
enabled: true
enabled_rules: []
disabled_rules: []
enabled_categories: []
disabled_categories: []
enabled_only: false
level: default
yamllint:
enabled: true
gitleaks:
enabled: true
actionlint:
enabled: true
semgrep:
enabled: true
clippy:
enabled: true
osvScanner:
enabled: true
chat:
art: false
auto_reply: true
knowledge_base:
opt_out: false
web_search:
enabled: true
code_guidelines:
enabled: true
filePatterns: []
learnings:
scope: auto
issues:
scope: local
pull_requests:
scope: local
mcp:
usage: enabled
disabled_servers: []
code_generation:
docstrings:
language: en-US
path_instructions:
- path: "src/lib.rs"
instructions: "Generate comprehensive rustdoc for public API with usage examples, error conditions, and performance notes. Include migration guide from libmagic and memory safety guarantees."
- path: "src/main.rs"
instructions: "Document CLI interface with usage examples, exit codes, and cross-platform considerations. Include troubleshooting and common use cases."
- path: "src/parser/**/*.rs"
instructions: "Document parser components with magic file syntax examples, error handling, and libmagic compatibility notes. Include serialization behavior and performance characteristics."
- path: "src/evaluator/**/*.rs"
instructions: "Document evaluation logic with performance notes, memory safety guarantees, and bounds checking behavior. Include endianness handling and type coercion examples."
- path: "src/output/**/*.rs"
instructions: "Document output formatting with examples matching GNU file command and JSON schema. Include encoding considerations and API versioning notes."
- path: "src/io/**/*.rs"
instructions: "Document I/O operations with memory safety guarantees, resource management, and performance characteristics. Include error recovery examples."
- path: "src/error.rs"
instructions: "Document error types with recovery strategies, debugging information, and user-friendly error messages. Include error propagation examples."
unit_tests:
path_instructions:
- path: "src/lib.rs"
instructions: "Generate API integration tests with real magic files, error condition testing, and memory safety validation. Include compatibility tests against libmagic."
- path: "src/main.rs"
instructions: "Test CLI interface with various arguments, error conditions, and cross-platform behavior. Include help text validation and exit code testing."
- path: "src/parser/**/*.rs"
instructions: "Test parser with malformed magic files, boundary conditions, escape sequences, and performance. Include property tests for parser correctness and fuzzing with proptest."
- path: "src/evaluator/**/*.rs"
instructions: "Test type interpretation, offset resolution, and operators with edge cases, overflow conditions, and endianness handling. Include property tests for invariants."
- path: "src/output/**/*.rs"
instructions: "Test output formatting with schema validation, metadata accuracy, GNU file compatibility, and serialization performance."
- path: "src/io/**/*.rs"
instructions: "Test I/O operations with truncated files, permission errors, memory mapping edge cases, and resource cleanup. Include memory safety tests and performance benchmarks."
- path: "src/error.rs"
instructions: "Test error handling with various failure scenarios, error propagation, and recovery strategies. Include user experience testing for error messages."
issue_enrichment:
auto_enrich:
enabled: true
planning:
enabled: false
labeling:
labeling_instructions:
- label: "bug"
instructions: "Apply when the issue reports incorrect behavior, crashes, panics, or unexpected results"
- label: "enhancement"
instructions: "Apply when the issue requests new functionality, new type/operator support, or feature improvements"
- label: "parser"
instructions: "Apply when the issue relates to magic file parsing, grammar rules, AST structures, or syntax handling"
- label: "evaluator"
instructions: "Apply when the issue relates to rule evaluation logic, offset resolution, type interpretation, or operator behavior"
- label: "io"
instructions: "Apply when the issue relates to file I/O, memory mapping, FileBuffer, or resource management"
- label: "output"
instructions: "Apply when the issue relates to result formatting, text/JSON output, or MIME type detection display"
- label: "cli"
instructions: "Apply when the issue relates to command-line interface, argument parsing, exit codes, or user-facing CLI behavior"
- label: "memory-safety"
instructions: "Apply when the issue reports or requests improvements to memory safety, bounds checking, or buffer handling"
- label: "performance"
instructions: "Apply when the issue reports slowness or requests performance optimizations, benchmarks, or efficiency improvements"
- label: "compatibility"
instructions: "Apply when the issue relates to libmagic compatibility, GNU file command behavior differences, or magic file format support gaps"
- label: "testing"
instructions: "Apply when the issue relates to test infrastructure, test coverage gaps, or testing utilities"
- label: "documentation"
instructions: "Apply when the issue reports missing, incorrect, or incomplete documentation"
- label: "good first issue"
instructions: "Apply when the issue is well-scoped, self-contained, and suitable for newcomers to the project"
- label: "priority:critical"
instructions: "Apply when the issue blocks a release or describes a severe correctness/safety problem"
- label: "priority:high"
instructions: "Apply when the issue has significant impact on compatibility, architecture, or user experience"
- label: "priority:normal"
instructions: "Apply when the issue is a standard work item with no unusual urgency"
- label: "priority:low"
instructions: "Apply when the issue is a nice-to-have improvement that can be deferred"