From aec254518c0040d1b3448ca40f11958f0e3e8d62 Mon Sep 17 00:00:00 2001 From: Kyle Dammann Date: Fri, 30 Oct 2026 22:01:49 +0100 Subject: [PATCH] Add ruff config and document Postgres test run - Lint rules (pycodestyle, pyflakes, bugbear, isort, pyupgrade, bandit) in pyproject.toml; ruff pinned in requirements-dev - Full suite verified against PostgreSQL (embedded pgserver), plus a production-like check: collectstatic with manifest storage, fresh migrations, ensure_admin and all main pages with DEBUG off Co-Authored-By: Claude Opus 5.5 --- CLAUDE.md | 4 ++++ pyproject.toml | 12 ++++++++++++ requirements-dev.txt | 1 + 3 files changed, 17 insertions(+) diff --git a/CLAUDE.md b/CLAUDE.md index 4521d0c..4855852 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -53,6 +53,10 @@ no JS build step: plain forms with small progressive enhancements in `static/js/ ```bash # Local (Windows dev box: venv lives at C:\Users\kyled\.venvs\kochbuch due to path-length issues) python -m pytest # tests (SQLite) +python -m ruff check . # lint (config in pyproject.toml) +# Postgres without Docker (dev box): pip install pgserver; start it, then +# POSTGRES_HOST=127.0.0.1 POSTGRES_PORT= POSTGRES_USER=postgres POSTGRES_DB=postgres python -m pytest +# (the Windows pgserver build lacks tz data: copy tzdata/zoneinfo to pginstall/share/postgresql/timezone) python scripts/dev_server.py # http://localhost:8000, admin@kochbuch.localhost SECRET_KEY=dev python manage.py makemigrations diff --git a/pyproject.toml b/pyproject.toml index a241d06..2a8e057 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,3 +7,15 @@ requires-python = ">=3.12" DJANGO_SETTINGS_MODULE = "config.settings_test" testpaths = ["tests"] addopts = "-q" + +[tool.ruff] +line-length = 120 +extend-exclude = ["*/migrations/*"] + +[tool.ruff.lint] +select = ["E", "F", "W", "B", "I", "UP", "S"] +ignore = ["E501", "S311"] + +[tool.ruff.lint.per-file-ignores] +"tests/*" = ["S101", "S104", "S105", "S106"] +"recipes/schema_org.py" = ["S110"] # malformed third-party HTML must never break an import diff --git a/requirements-dev.txt b/requirements-dev.txt index ce11a98..a712085 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,3 +1,4 @@ -r requirements.txt pytest==9.2.0 pytest-django==4.14.0 +ruff==0.17.3