Note: Bundled scripts ship as Markdown reference (.md) — copy the code out of the .md file to run it.
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-reviewer3description: 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---56> **Note:** Bundled scripts ship as Markdown reference (`.md`) — copy the code out of the `.md` file to run it.78# Code Reviewer910Automated code review tools for analyzing pull requests, detecting code quality issues, and generating review reports.1112---1314## Table of Contents1516- [Tools](#tools)17 - [PR Analyzer](#pr-analyzer)18 - [Code Quality Checker](#code-quality-checker)19 - [Review Report Generator](#review-report-generator)20- [Reference Guides](#reference-guides)21- [Languages Supported](#languages-supported)2223---2425## Tools2627### PR Analyzer2829Analyzes git diff between branches to assess review complexity and identify risks.3031```bash32# Analyze current branch against main33python scripts/pr_analyzer.py /path/to/repo3435# Compare specific branches36python scripts/pr_analyzer.py . --base main --head feature-branch3738# JSON output for integration39python scripts/pr_analyzer.py /path/to/repo --json40```4142**What it detects:**4344- Hardcoded secrets (passwords, API keys, tokens)45- SQL injection patterns (string concatenation in queries)46- Debug statements (debugger, console.log)47- ESLint rule disabling48- TypeScript `any` types49- TODO/FIXME comments5051**Output includes:**5253- Complexity score (1-10)54- Risk categorization (critical, high, medium, low)55- File prioritization for review order56- Commit message validation5758---5960### Code Quality Checker6162Analyzes source code for structural issues, code smells, and SOLID violations.6364```bash65# Analyze a directory66python scripts/code_quality_checker.py /path/to/code6768# Analyze specific language69python scripts/code_quality_checker.py . --language python7071# JSON output72python scripts/code_quality_checker.py /path/to/code --json73```7475**What it detects:**7677- Long functions (>50 lines)78- Large files (>500 lines)79- God classes (>20 methods)80- Deep nesting (>4 levels)81- Too many parameters (>5)82- High cyclomatic complexity83- Missing error handling84- Unused imports85- Magic numbers8687**Thresholds:**8889| Issue | Threshold |90| --------------- | ------------ |91| Long function | >50 lines |92| Large file | >500 lines |93| God class | >20 methods |94| Too many params | >5 |95| Deep nesting | >4 levels |96| High complexity | >10 branches |9798---99100### Review Report Generator101102Combines PR analysis and code quality findings into structured review reports.103104```bash105# Generate report for current repo106python scripts/review_report_generator.py /path/to/repo107108# Markdown output109python scripts/review_report_generator.py . --format markdown --output review.md110111# Use pre-computed analyses112python scripts/review_report_generator.py . \113 --pr-analysis pr_results.json \114 --quality-analysis quality_results.json115```116117**Report includes:**118119- Review verdict (approve, request changes, block)120- Score (0-100)121- Prioritized action items122- Issue summary by severity123- Suggested review order124125**Verdicts:**126127| Score | Verdict |128| ----------------------- | ------------------------ |129| 90+ with no high issues | Approve |130| 75+ with ≤2 high issues | Approve with suggestions |131| 50-74 | Request changes |132| <50 or critical issues | Block |133134---135136## Reference Guides137138### Code Review Checklist139140`references/code_review_checklist.md`141142Systematic checklists covering:143144- Pre-review checks (build, tests, PR hygiene)145- Correctness (logic, data handling, error handling)146- Security (input validation, injection prevention)147- Performance (efficiency, caching, scalability)148- Maintainability (code quality, naming, structure)149- Testing (coverage, quality, mocking)150- Language-specific checks151152### Coding Standards153154`references/coding_standards.md`155156Language-specific standards for:157158- TypeScript (type annotations, null safety, async/await)159- JavaScript (declarations, patterns, modules)160- Python (type hints, exceptions, class design)161- Go (error handling, structs, concurrency)162- Swift (optionals, protocols, errors)163- Kotlin (null safety, data classes, coroutines)164165### Common Antipatterns166167`references/common_antipatterns.md`168169Antipattern catalog with examples and fixes:170171- Structural (god class, long method, deep nesting)172- Logic (boolean blindness, stringly typed code)173- Security (SQL injection, hardcoded credentials)174- Performance (N+1 queries, unbounded collections)175- Testing (duplication, testing implementation)176- Async (floating promises, callback hell)177178---179180## Languages Supported181182| Language | Extensions |183| ---------- | --------------------- |184| Python | `.py` |185| TypeScript | `.ts`, `.tsx` |186| JavaScript | `.js`, `.jsx`, `.mjs` |187| Go | `.go` |188| Swift | `.swift` |189| Kotlin | `.kt`, `.kts` |