Skip to content

Commit 63228b5

Browse files
authored
Merge pull request #41 from phodal/add-augment-code-review-rules
Add Augment Code Review guidelines
2 parents 248ed9c + bc429c0 commit 63228b5

1 file changed

Lines changed: 146 additions & 0 deletions

File tree

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
# Augment Code Review Guidelines for Coca Project
2+
# This file defines custom code review rules for the Coca codebase analysis tool
3+
4+
areas:
5+
error_handling:
6+
description: "Error handling and nil safety in Go"
7+
globs:
8+
- "**/*.go"
9+
rules:
10+
- id: "proper_error_handling"
11+
description: "Always check and handle errors properly. Don't ignore errors with _ unless absolutely necessary and documented."
12+
severity: "high"
13+
14+
- id: "nil_pointer_checks"
15+
description: "Check for nil pointers before dereferencing, especially when working with pointers and interfaces."
16+
severity: "high"
17+
18+
- id: "error_wrapping"
19+
description: "Use error wrapping (fmt.Errorf with %w) to preserve error context in the call chain."
20+
severity: "medium"
21+
22+
concurrency_safety:
23+
description: "Concurrency and goroutine safety"
24+
globs:
25+
- "**/*.go"
26+
rules:
27+
- id: "goroutine_leaks"
28+
description: "Ensure goroutines have proper cleanup mechanisms and don't leak. Use context for cancellation."
29+
severity: "high"
30+
31+
- id: "race_conditions"
32+
description: "Protect shared state with proper synchronization (mutex, channels, or atomic operations)."
33+
severity: "high"
34+
35+
code_analysis_accuracy:
36+
description: "Accuracy and correctness of code analysis features"
37+
globs:
38+
- "pkg/application/**/*.go"
39+
- "pkg/infrastructure/ast/**/*.go"
40+
rules:
41+
- id: "ast_parsing_correctness"
42+
description: "Ensure AST parsing handles edge cases correctly. Validate input before processing."
43+
severity: "high"
44+
45+
- id: "analysis_result_validation"
46+
description: "Validate analysis results for completeness and correctness before returning."
47+
severity: "medium"
48+
49+
- id: "language_support_consistency"
50+
description: "Ensure consistent behavior across different language analyzers (Java, Go, Python, etc.)."
51+
severity: "medium"
52+
53+
domain_model_integrity:
54+
description: "Domain model and data structure integrity"
55+
globs:
56+
- "pkg/domain/**/*.go"
57+
rules:
58+
- id: "immutable_domain_objects"
59+
description: "Domain objects should be immutable where possible. Use value objects and avoid exposing internal state."
60+
severity: "medium"
61+
62+
- id: "domain_validation"
63+
description: "Validate domain objects at creation time. Don't allow invalid states."
64+
severity: "high"
65+
66+
performance:
67+
description: "Performance and resource management"
68+
globs:
69+
- "**/*.go"
70+
rules:
71+
- id: "avoid_unnecessary_allocations"
72+
description: "Minimize memory allocations in hot paths. Reuse buffers and objects where appropriate."
73+
severity: "medium"
74+
75+
- id: "file_handle_cleanup"
76+
description: "Always close file handles and other resources using defer immediately after opening."
77+
severity: "high"
78+
79+
- id: "large_file_handling"
80+
description: "Handle large files efficiently using streaming or chunking instead of loading entire files into memory."
81+
severity: "medium"
82+
83+
testing:
84+
description: "Test quality and coverage"
85+
globs:
86+
- "**/*_test.go"
87+
rules:
88+
- id: "test_isolation"
89+
description: "Tests should be isolated and not depend on external state or other tests."
90+
severity: "high"
91+
92+
- id: "test_data_fixtures"
93+
description: "Use test fixtures from _fixtures directory. Don't create test data in production code paths."
94+
severity: "medium"
95+
96+
- id: "table_driven_tests"
97+
description: "Prefer table-driven tests for testing multiple scenarios of the same functionality."
98+
severity: "low"
99+
100+
api_compatibility:
101+
description: "API and CLI compatibility"
102+
globs:
103+
- "cmd/**/*.go"
104+
rules:
105+
- id: "backward_compatibility"
106+
description: "Maintain backward compatibility for CLI commands and flags. Deprecate before removing."
107+
severity: "high"
108+
109+
- id: "command_output_format"
110+
description: "Ensure command output formats (JSON, CSV, table) are consistent and well-documented."
111+
severity: "medium"
112+
113+
code_quality:
114+
description: "General code quality and maintainability"
115+
globs:
116+
- "**/*.go"
117+
rules:
118+
- id: "avoid_magic_numbers"
119+
description: "Define constants for magic numbers and strings. Use meaningful names."
120+
severity: "low"
121+
122+
- id: "function_complexity"
123+
description: "Keep functions focused and simple. Break down complex functions into smaller, testable units."
124+
severity: "medium"
125+
126+
- id: "package_organization"
127+
description: "Follow the established package structure: domain, application, infrastructure, adapter."
128+
severity: "medium"
129+
130+
- id: "exported_documentation"
131+
description: "All exported functions, types, and constants must have documentation comments."
132+
severity: "medium"
133+
134+
dependency_management:
135+
description: "Dependency and import management"
136+
globs:
137+
- "**/*.go"
138+
rules:
139+
- id: "avoid_circular_dependencies"
140+
description: "Avoid circular dependencies between packages. Use interfaces for decoupling."
141+
severity: "high"
142+
143+
- id: "minimize_external_deps"
144+
description: "Minimize external dependencies. Evaluate necessity and maintenance status before adding new dependencies."
145+
severity: "medium"
146+

0 commit comments

Comments
 (0)