Setup
1. Create Review Rules File
Create areview.json
file in the same .codeant
folder in your repository root:
2. Define Custom Rules
Thereview.json
file allows you to specify additional rules that CodeAnt will enforce during every code review.
Configuration Format
Rule Categories
Code Quality Rules
No Console Logs in Production:Naming Convention Rules
Variable Naming:API and Architecture Rules
REST API Conventions:Security and Performance Rules
Password Validation:Sample review.json
How It Works
- Rule Enforcement: These custom rules are applied on top of CodeAnt’s default bug and security detection
- Review Integration: Custom rules are checked during both automatic (on commit) and manual reviews
- File Targeting: Rules only apply to files matching the specified glob patterns
- Scope Control: The optional
scope
parameter determines where rules are enforced - “ide” for IDE integration only, “pr” for pull request reviews only, or both. If not specified, defaults to [“ide”] - Priority: Custom rules complement, not replace, CodeAnt’s built-in detection capabilities
Best Practices
- Team Alignment: Ensure all team members agree on the custom rules before implementing
- Clear Descriptions: Write detailed descriptions explaining the reasoning behind each rule
- Gradual Implementation: Start with a few critical rules and expand over time
- Regular Review: Periodically review and update rules as your codebase evolves
- Documentation: Keep a separate document explaining your team’s coding standards