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

Rule Categories

Code Quality Rules

No Console Logs in Production:
Function Complexity:

Naming Convention Rules

Variable Naming:
Component Naming:

API and Architecture Rules

REST API Conventions:

Security and Performance Rules

Password Validation:
Database Query Optimization:

Sample 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.