These rules extend CodeAnt’s default bug and security detection with company-specific coding practices, naming conventions, and standards.

Accessing Dashboard Rules

Navigate to your Dashboard settings:

  1. Go to app.codeant.ai/settings/customized-review
  2. Select Rules from the dropdown menu
  3. Click Add New to create a new custom rule

Creating Rules

Step 1: Select Repositories

Choose which repositories should apply this rule:

  • Use the search bar to find specific repositories
  • Select multiple repositories using checkboxes
  • All selected repositories will receive the same rule

Step 2: Configure Rule

Rule Description (Required)

  • Provide a clear, specific description of what this rule enforces
  • Explain the reasoning behind the rule for team clarity

File Patterns (Required)

  • Specify which files this rule applies to using glob patterns
  • Click Add to include multiple patterns
  • Use minimatch syntax for pattern matching

Rule Categories

Code Quality Rules

No Console Logs in Production:

Description: "Never use console.log statements in production code. Use proper logging services instead. This prevents sensitive data leaks and improves performance."

File Patterns:
- src/**/*.js
- src/**/*.ts
- src/**/*.jsx
- src/**/*.tsx
- !**/*.dev.js
- !**/*.test.*

Function Complexity Limits:

Description: "Functions should not exceed 50 lines of code. Break down complex functions into smaller, more maintainable pieces."

File Patterns:
- src/**/*.js
- src/**/*.ts
- utils/**/*.js

Dead Code Detection:

Description: "Remove unused imports, variables, and functions. Keep codebase clean and maintainable by eliminating dead code."

File Patterns:
- **/*.js
- **/*.ts
- **/*.jsx
- **/*.tsx

API and Architecture Rules

REST API Conventions:

Description: "REST API endpoints must use kebab-case and follow RESTful patterns: GET /users, POST /users, PUT /users/:id, DELETE /users/:id."

File Patterns:
- routes/**/*.js
- src/api/**/*.ts
- controllers/**/*.py

Pattern Examples

Common File Patterns

PatternDescription
src/**/*.{js,ts}All JavaScript/TypeScript in src
**/*.test.*All test files
src/components/**/*.tsxReact components only
!**/node_modules/**Exclude dependencies
{api,routes}/**/*.jsAPI and route files
src/{models,entities}/**/*Data models
**/*.{css,scss,less}Stylesheets
src/utils/**/*.tsUtility functions

Advanced Patterns

PatternDescription
`src/**/!(*.test.spec).`Source files excluding tests
**/*.{config,conf}.{js,ts}Configuration files
{src,lib,app}/**/*.tsMultiple source directories
**/*{Controller,Service,Repository}.*Specific class types
src/**/*.{gql,graphql}GraphQL files

Custom rules work alongside CodeAnt’s built-in detection, providing comprehensive code review coverage tailored to your team’s specific needs.