Skip to content

Commit a6b13f9

Browse files
committed
Add CodeReviewGPT scaffold, tests, and tooling
1 parent a08dd12 commit a6b13f9

18 files changed

+296
-13
lines changed

.github/workflows/python.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
python-version: ["3.10", "3.11", "3.12", "3.13"]
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Set up Python
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: ${{ matrix.python-version }}
19+
cache: pip
20+
- name: Install dependencies
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install -r requirements.txt
24+
pip install -r requirements-dev.txt
25+
- name: Run tests
26+
run: python -m pytest

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
__pycache__/
2+
*.pyc
3+
.venv/

Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.PHONY: install install-dev test lint
2+
3+
install:
4+
python -m pip install -r requirements.txt
5+
6+
install-dev:
7+
python -m pip install -r requirements.txt
8+
python -m pip install -r requirements-dev.txt
9+
10+
test:
11+
python -m pytest
12+
13+
lint:
14+
python -m flake8 src tests

README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,42 @@
22

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

5+
## Architecture
6+
```mermaid
7+
flowchart TD
8+
CLI[CLI Entry] --> CFG[Config Loader]
9+
CFG --> ANA[Code Analyzer]
10+
ANA --> INT[Internal Checks]
11+
ANA --> TOOLS[Static Tools]
12+
ANA -->|optional| LLM[LLM Review]
13+
INT --> MERGE[Merge Findings]
14+
TOOLS --> MERGE
15+
LLM --> MERGE
16+
MERGE --> OUT[Report Formatter]
17+
OUT --> TERM[Terminal]
18+
OUT --> MD[Markdown]
19+
OUT --> JSON[JSON]
20+
OUT --> HTML[HTML]
21+
```
22+
23+
## Analyzer Flow
24+
```mermaid
25+
sequenceDiagram
26+
participant User
27+
participant CLI
28+
participant Analyzer
29+
participant Tools
30+
participant LLM
31+
participant Formatter
32+
33+
User->>CLI: codereview analyze path
34+
CLI->>Analyzer: analyze_path()
35+
Analyzer->>Tools: run static tools
36+
Analyzer->>LLM: review_code() (optional)
37+
Analyzer->>Formatter: render output
38+
Formatter-->>User: report
39+
```
40+
541
## Features
642
- Scan a file or directory of Python sources
743
- Runs static tools (pylint, bandit, flake8, radon) if installed
@@ -18,6 +54,24 @@ pip install -r requirements.txt
1854
codereview analyze path/to/project --format markdown --output report.md
1955
```
2056

57+
## Developer Commands
58+
Makefile (Unix):
59+
```bash
60+
make install-dev
61+
make test
62+
```
63+
64+
Justfile (PowerShell):
65+
```bash
66+
just install-dev
67+
just test
68+
```
69+
70+
Windows helper:
71+
```bash
72+
scripts\\dev.cmd test
73+
```
74+
2175
## Example Config
2276
```bash
2377
codereview config-example > config.json

SOLUTION.md

Lines changed: 0 additions & 10 deletions
This file was deleted.

justfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
set shell := ["powershell", "-NoProfile", "-Command"]
2+
3+
install:
4+
python -m pip install -r requirements.txt
5+
6+
install-dev:
7+
python -m pip install -r requirements.txt
8+
python -m pip install -r requirements-dev.txt
9+
10+
test:
11+
python -m pytest
12+
13+
lint:
14+
python -m flake8 src tests

pyproject.toml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[build-system]
2+
requires = ["setuptools>=68.0", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "code-review-gpt"
7+
version = "0.1.0"
8+
description = "Intelligent code review CLI"
9+
readme = "README.md"
10+
requires-python = ">=3.10"
11+
dependencies = []
12+
13+
[project.scripts]
14+
codereview = "codereviewgpt.cli:app"

requirements-dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pytest>=9.0.0

scripts/dev.cmd

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
@echo off
2+
setlocal
3+
4+
if "%1"=="" goto :help
5+
6+
if /I "%1"=="install" (
7+
python -m pip install -r requirements.txt
8+
goto :eof
9+
)
10+
11+
if /I "%1"=="install-dev" (
12+
python -m pip install -r requirements.txt
13+
python -m pip install -r requirements-dev.txt
14+
goto :eof
15+
)
16+
17+
if /I "%1"=="test" (
18+
python -m pytest
19+
goto :eof
20+
)
21+
22+
if /I "%1"=="lint" (
23+
python -m flake8 src tests
24+
goto :eof
25+
)
26+
27+
:help
28+
echo Usage: scripts\dev.cmd [install^|install-dev^|test^|lint]

setup.cfg

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[metadata]
2+
name = code-review-gpt
3+
version = 0.1.0
4+
description = Intelligent code review CLI
5+
long_description = file: README.md
6+
long_description_content_type = text/markdown
7+
8+
[options]
9+
package_dir =
10+
= src
11+
packages = find:
12+
13+
[options.packages.find]
14+
where = src
15+
16+
[options.entry_points]
17+
console_scripts =
18+
codereview = codereviewgpt.cli:app

0 commit comments

Comments
 (0)