Skip to main content
CodeAnt AI automatically detects bugs and security issues by default. However, you can extend CodeAnt’s review capabilities by defining custom rules that enforce company-specific coding practices, naming conventions, and standards.

Setup

1. Create Review Rules File

Create a review.json file in the same .codeant folder in your repository root:

2. Define Custom Rules

The review.json file allows you to specify additional rules that CodeAnt will enforce during every code review.

Configuration Format

.codeant/review.json

Rule Categories

Add each rule object below to the rules array in .codeant/review.json.

Code Quality Rules

No Console Logs in Production:
.codeant/review.json
Function Complexity:
.codeant/review.json

Naming Convention Rules

Variable Naming:
.codeant/review.json
Component Naming:
.codeant/review.json

API and Architecture Rules

REST API Conventions:
.codeant/review.json

Security and Performance Rules

Password Validation:
.codeant/review.json
Database Query Optimization:
.codeant/review.json

Sample review.json

.codeant/review.json

How It Works

  1. Rule Enforcement: These custom rules are applied on top of CodeAnt’s default bug and security detection
  2. Review Integration: Custom rules are checked during both automatic (on commit) and manual reviews
  3. File Targeting: Rules only apply to files matching the specified glob patterns
  4. 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”]
  5. 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
Once configured, CodeAnt will enforce these custom rules alongside its default bug and security detection during every code review.