An extensible API that reviews source code for bugs, smells, style issues, and complexity. It combines static analysis (AST + Radon) with optional LLM feedback.
Works offline for static checks. If you set
OPENAI_API_KEYor connect to an Ollama model, you'll also get AI feedback.
- 🚦
POST /reviewaccepts code & language (Python supported in v1) - 🧠 Static findings: syntax errors, complexity, maintainability, common pitfalls
- 🧩 Optional LLM feedback (OpenAI or local Ollama) via adapters
- 📊 Rich, structured JSON with severities and line numbers
- 🐳 Dockerized +
uvicornfor production - ✅ Tests included (pytest)
# 1) Create a venv and install deps
python3 -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
# 2) Run the API
uvicorn app.main:app --reload
# 3) Open docs
# http://127.0.0.1:8000/docsdocker build -t code-reviewer-api .
docker run -p 8000:8000 --env-file .env code-reviewer-apiCopy .env.example to .env and fill as needed:
OPENAI_API_KEY=sk-...
OPENAI_MODEL=gpt-4o-mini
OLLAMA_BASE_URL=http://localhost:11434
OLLAMA_MODEL=codellama:7bcurl -X POST http://127.0.0.1:8000/review \ -H "Content-Type: application/json" \ -d @- <<'JSON'
{
"language": "python",
"code": "def foo(x=[]):\n try:\n print('hi')\n except:\n pass\n return 1"
}
JSONcode-reviewer-api/
├── app/
│ ├── main.py
│ ├── config.py
│ ├── schemas.py
│ ├── services/
│ │ └── aggregator.py
│ └── review_engine/
│ ├── __init__.py
│ ├── static_checks.py
│ ├── llm_checks.py
│ └── helpers.py
├── sample_code/
│ └── bad.py
├── tests/
│ ├── test_health.py
│ └── test_review.py
├── requirements.txt
├── Dockerfile
├── Makefile
├── .env.example
└── README.md
- The static analyzer currently supports Python. The design is language-pluggable.
- You can extend
review_engine/static_checks.pyandhelpers.pyfor new rules. - LLM adapters are optional and never send code unless you configure them.