Code Reviewer
Automated code review tools for analyzing pull requests, detecting code quality issues, and generating review reports.
Table of Contents
Tools
PR Analyzer
Analyzes git diff between branches to assess review complexity and identify risks.
# Analyze current branch against main
python scripts/pr_analyzer.py /path/to/repo
# Compare specific branches
python scripts/pr_analyzer.py . --base main --head feature-branch
# JSON output for integration
python scripts/pr_analyzer.py /path/to/repo --json
What it detects:
- Hardcoded secrets (passwords, API keys, tokens)
- SQL injection patterns (string concatenation in queries)
- Debug statements (debugger, console.log)
- ESLint rule disabling
- TypeScript
any types
- TODO/FIXME comments
Output includes:
- Complexity score (1-10)
- Risk categorization (critical, high, medium, low)
- File prioritization for review order
- Commit message validation
Code Quality Checker
Analyzes source code for structural issues, code smells, and SOLID violations.
# Analyze a directory
python scripts/code_quality_checker.py /path/to/code
# Analyze specific language
python scripts/code_quality_checker.py . --language python
# JSON output
python scripts/code_quality_checker.py /path/to/code --json
What it detects:
- Long functions (>50 lines)
- Large files (>500 lines)
- God classes (>20 methods)
- Deep nesting (>4 levels)
- Too many parameters (>5)
- High cyclomatic complexity
- Missing error handling
- Unused imports
- Magic numbers
Thresholds:
| Issue |
Threshold |
| Long function |
>50 lines |
| Large file |
>500 lines |
| God class |
>20 methods |
| Too many params |
>5 |
| Deep nesting |
>4 levels |
| High complexity |
>10 branches |
Review Report Generator
Combines PR analysis and code quality findings into structured review reports.
# Generate report for current repo
python scripts/review_report_generator.py /path/to/repo
# Markdown output
python scripts/review_report_generator.py . --format markdown --output review.md
# Use pre-computed analyses
python scripts/review_report_generator.py . \
--pr-analysis pr_results.json \
--quality-analysis quality_results.json
Report includes:
- Review verdict (approve, request changes, block)
- Score (0-100)
- Prioritized action items
- Issue summary by severity
- Suggested review order
Verdicts:
| Score |
Verdict |
| 90+ with no high issues |
Approve |
| 75+ with ≤2 high issues |
Approve with suggestions |
| 50-74 |
Request changes |
| <50 or critical issues |
Block |
Reference Guides
Code Review Checklist
references/code_review_checklist.md
Systematic checklists covering:
- Pre-review checks (build, tests, PR hygiene)
- Correctness (logic, data handling, error handling)
- Security (input validation, injection prevention)
- Performance (efficiency, caching, scalability)
- Maintainability (code quality, naming, structure)
- Testing (coverage, quality, mocking)
- Language-specific checks
Coding Standards
references/coding_standards.md
Language-specific standards for:
- TypeScript (type annotations, null safety, async/await)
- JavaScript (declarations, patterns, modules)
- Python (type hints, exceptions, class design)
- Go (error handling, structs, concurrency)
- Swift (optionals, protocols, errors)
- Kotlin (null safety, data classes, coroutines)
Common Antipatterns
references/common_antipatterns.md
Antipattern catalog with examples and fixes:
- Structural (god class, long method, deep nesting)
- Logic (boolean blindness, stringly typed code)
- Security (SQL injection, hardcoded credentials)
- Performance (N+1 queries, unbounded collections)
- Testing (duplication, testing implementation)
- Async (floating promises, callback hell)
Languages Supported
| Language |
Extensions |
| Python |
.py |
| TypeScript |
.ts, .tsx |
| JavaScript |
.js, .jsx, .mjs |
| Go |
.go |
| Swift |
.swift |
| Kotlin |
.kt, .kts |
1---2name: code-reviewer-103description: Code review automation for TypeScript, JavaScript, Python, Go, Swift, Kotlin. Analyzes PRs for complexity and risk, checks code quality for SOLID violations and code smells, generates review reports. Use when reviewing pull requests, analyzing code quality, identifying issues, generating review checklists.4---5
6# Code Reviewer
7
8Automated code review tools for analyzing pull requests, detecting code quality issues, and generating review reports.
9
10---
11
12## Table of Contents
13
14- [Tools](#tools)
15 - [PR Analyzer](#pr-analyzer)
16 - [Code Quality Checker](#code-quality-checker)
17 - [Review Report Generator](#review-report-generator)
18- [Reference Guides](#reference-guides)
19- [Languages Supported](#languages-supported)
20
21---
22
23## Tools
24
25### PR Analyzer
26
27Analyzes git diff between branches to assess review complexity and identify risks.
28
29```bash
30# Analyze current branch against main
31python scripts/pr_analyzer.py /path/to/repo
32
33# Compare specific branches
34python scripts/pr_analyzer.py . --base main --head feature-branch
35
36# JSON output for integration
37python scripts/pr_analyzer.py /path/to/repo --json
38```
39
40**What it detects:**
41- Hardcoded secrets (passwords, API keys, tokens)
42- SQL injection patterns (string concatenation in queries)
43- Debug statements (debugger, console.log)
44- ESLint rule disabling
45- TypeScript `any` types
46- TODO/FIXME comments
47
48**Output includes:**
49- Complexity score (1-10)
50- Risk categorization (critical, high, medium, low)
51- File prioritization for review order
52- Commit message validation
53
54---
55
56### Code Quality Checker
57
58Analyzes source code for structural issues, code smells, and SOLID violations.
59
60```bash
61# Analyze a directory
62python scripts/code_quality_checker.py /path/to/code
63
64# Analyze specific language
65python scripts/code_quality_checker.py . --language python
66
67# JSON output
68python scripts/code_quality_checker.py /path/to/code --json
69```
70
71**What it detects:**
72- Long functions (>50 lines)
73- Large files (>500 lines)
74- God classes (>20 methods)
75- Deep nesting (>4 levels)
76- Too many parameters (>5)
77- High cyclomatic complexity
78- Missing error handling
79- Unused imports
80- Magic numbers
81
82**Thresholds:**
83
84| Issue | Threshold |
85|-------|-----------|
86| Long function | >50 lines |
87| Large file | >500 lines |
88| God class | >20 methods |
89| Too many params | >5 |
90| Deep nesting | >4 levels |
91| High complexity | >10 branches |
92
93---
94
95### Review Report Generator
96
97Combines PR analysis and code quality findings into structured review reports.
98
99```bash
100# Generate report for current repo
101python scripts/review_report_generator.py /path/to/repo
102
103# Markdown output
104python scripts/review_report_generator.py . --format markdown --output review.md
105
106# Use pre-computed analyses
107python scripts/review_report_generator.py . \
108 --pr-analysis pr_results.json \
109 --quality-analysis quality_results.json
110```
111
112**Report includes:**
113- Review verdict (approve, request changes, block)
114- Score (0-100)
115- Prioritized action items
116- Issue summary by severity
117- Suggested review order
118
119**Verdicts:**
120
121| Score | Verdict |
122|-------|---------|
123| 90+ with no high issues | Approve |
124| 75+ with ≤2 high issues | Approve with suggestions |
125| 50-74 | Request changes |
126| <50 or critical issues | Block |
127
128---
129
130## Reference Guides
131
132### Code Review Checklist
133`references/code_review_checklist.md`
134
135Systematic checklists covering:
136- Pre-review checks (build, tests, PR hygiene)
137- Correctness (logic, data handling, error handling)
138- Security (input validation, injection prevention)
139- Performance (efficiency, caching, scalability)
140- Maintainability (code quality, naming, structure)
141- Testing (coverage, quality, mocking)
142- Language-specific checks
143
144### Coding Standards
145`references/coding_standards.md`
146
147Language-specific standards for:
148- TypeScript (type annotations, null safety, async/await)
149- JavaScript (declarations, patterns, modules)
150- Python (type hints, exceptions, class design)
151- Go (error handling, structs, concurrency)
152- Swift (optionals, protocols, errors)
153- Kotlin (null safety, data classes, coroutines)
154
155### Common Antipatterns
156`references/common_antipatterns.md`
157
158Antipattern catalog with examples and fixes:
159- Structural (god class, long method, deep nesting)
160- Logic (boolean blindness, stringly typed code)
161- Security (SQL injection, hardcoded credentials)
162- Performance (N+1 queries, unbounded collections)
163- Testing (duplication, testing implementation)
164- Async (floating promises, callback hell)
165
166---
167
168## Languages Supported
169
170| Language | Extensions |
171|----------|------------|
172| Python | `.py` |
173| TypeScript | `.ts`, `.tsx` |
174| JavaScript | `.js`, `.jsx`, `.mjs` |
175| Go | `.go` |
176| Swift | `.swift` |
177| Kotlin | `.kt`, `.kts` |