Skip to content

Review Code Tools

Status: Canonical Reference
Scope: Code review and validation tools in tools/review-code/
Last Updated: December 31, 2025 19:22:24
Created: December 27, 2025 13:49:14

Code review and validation tools for the NeetCode Practice Framework.

Overview

The review-code module provides tools for: - Code format validation - Solution file compliance checking - Docstring auto-fixing - Test format checking

Module Structure

tools/review-code/
β”œβ”€β”€ __init__.py
β”œβ”€β”€ fix_docstring.py           # Auto-fix file-level docstrings
β”œβ”€β”€ test_fetcher.py            # LeetCode data fetching
β”œβ”€β”€ test_leetscrape.py         # Leetscrape testing
β”œβ”€β”€ NAMING_ANALYSIS.md         # Naming convention analysis
β”œβ”€β”€ README.md                  # Module documentation
β”‚
└── validation/                # Validation tools
    β”œβ”€β”€ check_solutions.py     # Solution file checker
    β”œβ”€β”€ check_test_files.py    # Test file format checker
    β”œβ”€β”€ check_solution_contract.py  # Solution contract checker
    β”œβ”€β”€ run_format_tests.py    # Format test runner
    β”œβ”€β”€ run_format_tests.bat   # Windows batch script
    β”œβ”€β”€ run_format_tests.sh    # Unix shell script
    └── tests/                 # Validation tests
        └── test_solution_format.py

Validation Tools

check_solutions.py

Validates solution files for Pure Polymorphic Architecture compliance.

python tools/review-code/validation/check_solutions.py              # Standard check
python tools/review-code/validation/check_solutions.py --verbose    # Show fix suggestions
python tools/review-code/validation/check_solutions.py --list-warnings  # List warnings only
python tools/review-code/validation/check_solutions.py --show-warnings  # Show warnings with suggestions

Checks Performed:

Category What It Checks
Architecture SOLUTIONS dictionary exists with class field
No wrapper functions (solve_*)
solve() uses get_solver()
Correct import: from _runner import get_solver
Format Comments use Solution 1: format
Comments placed BEFORE class definition
Complexity Each solution has # Time: O(...)
Each solution has # Space: O(...)

check_test_files.py

Checks and fixes double newline ending errors in test files.

python tools/review-code/validation/check_test_files.py              # List issues
python tools/review-code/validation/check_test_files.py --fix        # Auto-fix
python tools/review-code/validation/check_test_files.py --verbose    # Detailed info

run_format_tests.py

Runs format compliance unit tests.

python tools/review-code/validation/run_format_tests.py           # Standard run
python tools/review-code/validation/run_format_tests.py --verbose # Verbose output

Code Review Tools

fix_docstring.py

Auto-fixes file-level docstrings by fetching data from LeetCode.

# Fix files in range
python tools/review-code/fix_docstring.py --range 77 142

# Fix single file
python tools/review-code/fix_docstring.py --range 202 202

# Custom delay
python tools/review-code/fix_docstring.py --range 77 142 --delay-min 3.0 --delay-max 8.0

Parameters:

Parameter Default Description
--range START END Required Problem number range
--delay-min 3.0 Minimum delay between requests
--delay-max 8.0 Maximum delay between requests

Testing

# Run validation tests
python -m pytest tools/review-code/validation/tests -v

# Run format check
python tools/review-code/validation/check_solutions.py

See Also