diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..59517eb9 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,15 @@ +repos: + - repo: local + hooks: + - id: ruff + name: ruff + entry: ruff check --fix + language: system + types: [python] + require_serial: true + - id: ruff-format + name: ruff-format + entry: ruff format + language: system + types: [python] + require_serial: true \ No newline at end of file diff --git a/README.md b/README.md index 5043c104..0bb89d0d 100644 --- a/README.md +++ b/README.md @@ -118,6 +118,7 @@ Then run the following commands. ```bash python -m pip install -U -r requirements-dev.txt +pre-commit install cd src python manage.py migrate python manage.py runserver & celery -A config worker --beat --scheduler django --loglevel DEBUG & tailwindcss -i ./static/css/input.css -o ./static/css/tailwind.css --watch diff --git a/pyproject.toml b/pyproject.toml index 9e47268f..3d576d91 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ extend-exclude = ["migrations"] [tool.ruff.lint] select = ["ALL"] -ignore = ["ANN", "PT", "PD", "D100", "D104", "RUF012", "PLR0913", "SLF001"] +ignore = ["ANN", "PT", "PD", "D100", "D104", "RUF012", "PLR0913", "SLF001", "COM812"] [tool.ruff.lint.pycodestyle] max-doc-length = 88 diff --git a/requirements-dev.txt b/requirements-dev.txt index de3962e8..7d5f7a48 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,6 +1,7 @@ coverage==7.13.0 djlint==1.36.4 fakeredis==2.33.0 +pre-commit==4.5.1 pytest-django==4.11.1 pytest-playwright==0.7.2 ruff==0.14.10