Skip to content

CodeReviewGPT is a Python CLI that blends static analysis with optional LLM review to surface bugs, security risks, and maintainability issues.

Notifications You must be signed in to change notification settings

cschladetsch/PyCodeReviewAI

Repository files navigation

CodeReviewGPT

CodeReviewGPT is a Python CLI that blends static analysis with optional LLM review to surface bugs, security risks, and maintainability issues.

Architecture

flowchart TD
    CLI[CLI Entry] --> CFG[Config Loader]
    CFG --> ANA[Code Analyzer]
    ANA --> INT[Internal Checks]
    ANA --> TOOLS[Static Tools]
    ANA -->|optional| LLM[LLM Review]
    INT --> MERGE[Merge Findings]
    TOOLS --> MERGE
    LLM --> MERGE
    MERGE --> OUT[Report Formatter]
    OUT --> TERM[Terminal]
    OUT --> MD[Markdown]
    OUT --> JSON[JSON]
    OUT --> HTML[HTML]
Loading

Analyzer Flow

sequenceDiagram
    participant User
    participant CLI
    participant Analyzer
    participant Tools
    participant LLM
    participant Formatter

    User->>CLI: codereview analyze path
    CLI->>Analyzer: analyze_path()
    Analyzer->>Tools: run static tools
    Analyzer->>LLM: review_code() (optional)
    Analyzer->>Formatter: render output
    Formatter-->>User: report
Loading

Features

  • Scan a file or directory of Python sources
  • Runs static tools (pylint, bandit, flake8, radon) if installed
  • Runs internal checks (TODOs, long files/functions, missing docstrings)
  • Optional LLM review (Claude/OpenAI) with JSON parsing
  • Output formats: terminal, markdown, json, html

Quick Start

python -m venv .venv
. .venv/bin/activate
pip install -r requirements.txt

codereview analyze path/to/project --format markdown --output report.md

Developer Commands

Makefile (Unix):

make install-dev
make test

Justfile (PowerShell):

just install-dev
just test

Windows helper:

scripts\\dev.cmd test

Example Config

codereview config-example > config.json
codereview analyze path/to/project --config config.json

Environment Variables

  • OPENAI_API_KEY
  • ANTHROPIC_API_KEY
  • CODEREVIEW_PROVIDER
  • CODEREVIEW_SEVERITY
  • CODEREVIEW_FORMAT

Notes

  • Static tool integrations are best-effort; install tools you need.
  • Use --no-llm to disable LLM calls.

About

CodeReviewGPT is a Python CLI that blends static analysis with optional LLM review to surface bugs, security risks, and maintainability issues.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages