Turn a git diff (or your whole repository) into a ranked risk report that blends:
- Security findings (Bandit)
- Style/quality issues (Flake8)
- Complexity signals (Radon)
Outputs a tidy report.md you can attach to pull requests or releases.
- Python 3.11+
- Git
- (Optional) Docker
- (Optional) Make
Windows users: examples below show PowerShell and CMD variants where needed.
# HTTPS
git clone https://github.com/<owner>/<repo>.git
cd <repo># SSH (optional)
git clone git@github.com:<owner>/<repo>.git
cd <repo>pip install -r requirements.txtmacOS/Linux
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtWindows PowerShell
py -3 -m venv .venv
. .venv/Scripts/Activate.ps1
pip install -r requirements.txtpytest -qExpected: tests pass; artifacts are not created here.
python review.py --range HEAD~1..HEAD --output report.mdpython review.py --all --output report.mdOpen report.md to view the ranked issues.
docker build -t aicrl:local .Windows PowerShell
docker run --rm -v "${PWD}:/app" -w /app aicrl:local --all --output report.mdWindows CMD
docker run --rm -v "%cd%:/app" -w /app aicrl:local --all --output report.mdmacOS/Linux
docker run --rm -v "$PWD:/app" -w /app aicrl:local --all --output report.md- Install deps
- Run tests
- Generate report.md
- Upload report.md as a build artifact
Workflow excerpt (.github/workflows/ci.yml):
- run: pytest -q
- run: python review.py --all --output report.md
- uses: actions/upload-artifact@v4
with:
name: code-review-report
path: report.md- Tag
vX.Y.Z→ publish Release withreport.md - Build & push container image to GHCR
Workflow excerpt (.github/workflows/release.yml):
on:
push:
tags: ["v*"]analyzers/
__init__.py
run_tools.py # adapters for flake8/bandit/radon
aggregate.py # ranking & markdown rendering
tests/
conftest.py # adds repo root to PYTHONPATH
test_aggregate.py
test_integration.py
examples/
withbugs.py # intentionally insecure/noisy sample
review.py # CLI entry point
- Flake8 rules:
.flake8 - Bandit rules:
.bandit - Adjust line length & ignores to your team’s style.
Use a wider range or full scan:
python review.py --range HEAD~10..HEAD --output report.md
# or
python review.py --all --output report.mdUse the correct syntax for your shell:
- PowerShell:
-v "${PWD}:/app" - CMD:
-v "%cd%:/app" - macOS/Linux:
-v "$PWD:/app"
Either install git in the image (see Dockerfile) or run with --all to scan the repo without git.
make setup # pip install -r requirements.txt
make lint # flake8
make test # pytest
make run # python review.py --all --output report.md
make docker # docker build -t aicrl:local .- SARIF output for GitHub Code Scanning
- Inline PR comments (GitHub App)
- LLM hints for top‑N issues (off by default)
- Language plugins (ESLint, Trivy for Dockerfiles)
MIT — see LICENSE.md.