Code Review
How AI Code Review Works#
Codluma performs a multi-stage analysis on every pull request diff, combining deterministic pattern matching with large-language-model semantic understanding to catch issues that neither approach could find alone.
Diff-only analysis
Only changed lines are sent for AI analysis — never your full source files or commit history.
claude-sonnet-4-6
Powered by Anthropic Claude Sonnet 4.6, one of the most capable models for code understanding.
Rule-based pre-scan
Deterministic checks for secrets, SQL injection, and OWASP patterns run before any AI call.
No training on your code
Your diffs are never used to fine-tune or retrain any shared AI model.
The review pipeline
Webhook received
GitHub or GitLab fires a pull_request webhook to Codluma the moment a PR is opened or a new commit is pushed.
Diff fetched
Codluma fetches only the unified diff of changed files. Files larger than 500 KB are skipped with a note in the review.
Rule-based pre-scan
Deterministic regex and AST-based rules check for hardcoded secrets, known injection patterns, and security anti-patterns in milliseconds.
AI semantic analysis
The sanitised diff (with secrets redacted) is sent to Claude Sonnet 4.6. The model analyses logic, security, performance, and code quality.
Finding deduplication
Findings from both stages are merged, deduplicated, and ranked by severity.
PR annotation
Each finding is posted as an inline comment on the exact line. A summary comment lists all findings with severity counts.
Timing & latency
Severity Guide#
Every finding is assigned one of four severity levels calibrated to real-world risk — not to inflate numbers or generate noise.
Security vulnerabilities that could allow data breach, authentication bypass, privilege escalation, or unrecoverable data loss. Examples: SQL injection, hardcoded credentials, RCE vectors.
PR effect: Block merge — PR status check fails.
Logic errors, null pointer dereferences, race conditions, resource leaks, and incorrect behavior in important edge cases that could cause production incidents.
PR effect: PR status check shows warning.
Code quality issues, missing error handling, performance anti-patterns, deprecated API usage, and maintainability concerns that accumulate technical debt.
PR effect: Informational comment only.
Style suggestions, naming improvements, documentation gaps, and minor improvements with no functional impact.
PR effect: Informational comment only.
Tip
Finding Categories#
Every finding is tagged with one of eight categories. You can enable or disable individual categories per repository in Settings → Review Rules → Categories.
Tip
Strictness Levels#
Strictness controls how aggressively the AI reviews. It affects both which categories produce findings and the confidence threshold required before a finding is posted.
Only critical issues — security flaws and breaking bugs. Noise-free for teams iterating quickly.
Balanced feedback — correctness, security, and notable performance issues. The default for most teams.
Thorough review — all categories, moderate-confidence findings included. Suitable for production-critical services.
Everything — including stylistic nits, naming suggestions, and minor documentation gaps. Best for teams with high quality bars.
Note
Custom Review Rules#
Custom rules let you encode your architecture decisions, forbidden patterns, required libraries, and style standards so Codluma enforces them automatically on every PR.
Rule types
Pattern rules
Regex or glob patterns that flag specific strings, method calls, or file paths. Zero AI latency — runs in the pre-scan phase.
AI-guided rules
Plain-English instructions sent to the AI alongside the diff. Use for architectural constraints or nuanced style rules.
File-scope rules
Rules that only apply to specific directories or file extensions.
Suppression rules
Exclude specific files, patterns, or finding types — useful for generated code or vendored libraries.
Configuring rules via reviewops.yml
Add a reviewops.yml file to the root of any repository to configure rules for that repo.
# reviewops.yml — place in repo root
version: 1
review:
blocking_severity: critical # critical | high | medium | off
forbidden_patterns:
- pattern: "console\.log"
message: "Remove debug logging before merge"
severity: medium
files: ["src/**/*.ts", "src/**/*.tsx"]
- pattern: "TODO|FIXME|HACK"
message: "Resolve outstanding TODO/FIXME before merging"
severity: info
exclude:
- "**/__generated__/**"
- "**/vendor/**"
- "**/*.min.js"
ai_instructions: |
This codebase uses React Query for all data fetching.
Flag any direct fetch() or axios calls in component files as High severity.
All database queries must go through the repository layer in src/repositories/.
Flag any direct DB calls in service or controller files as Critical.Note
reviewops.yml file is read on every PR — changes take effect immediately on the next PR without any dashboard action.Fix Suggestions#
For Critical and High findings, Codluma generates a concrete code fix alongside the explanation, shown directly in the GitHub/GitLab review comment.
Example fix suggestion
### 🔴 Critical — SQL Injection (src/users/UserRepository.ts:47)
**Issue:** The `userId` parameter is interpolated directly into the SQL string.
An attacker controlling this parameter can execute arbitrary SQL.
**Vulnerable code:**
```typescript
const result = await db.query(`SELECT * FROM users WHERE id = ${userId}`)
```
**Fix:**
```typescript
const result = await db.query('SELECT * FROM users WHERE id = $1', [userId])
```
> Use parameterized queries for all user-supplied values.When fixes are generated
Warning
Can't find what you need?
Contact support