From cb5cdb35f190d5a5bfd662e4f52509b06d95a218 Mon Sep 17 00:00:00 2001 From: georgebv Date: Fri, 29 Mar 2024 20:39:13 +0000 Subject: [PATCH] added pre-commit --- .devcontainer/post-create.sh | 1 + .pre-commit-config.yaml | 25 +++++++++++++++++++++++++ pyproject.toml | 2 ++ requirements-dev.lock | 17 +++++++++++++++++ 4 files changed, 45 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh index df353bf..982c443 100755 --- a/.devcontainer/post-create.sh +++ b/.devcontainer/post-create.sh @@ -4,3 +4,4 @@ set -ex printf "\nalias ll='ls -lahSr --color=auto'\n" >> ~/.bashrc rye sync +rye run pre-commit install diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..ebfbe16 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,25 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: check-toml + - id: check-yaml + args: ["--unsafe"] + - id: end-of-file-fixer + - id: trailing-whitespace + exclude: .+\.csv + - id: mixed-line-ending + args: [--fix=lf] + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.3.4 + hooks: + - id: ruff + - id: ruff-format + - repo: local + hooks: + - id: ruff-sort-imports + name: ruff-sort-imports + entry: rye run ruff check --select I . + language: system + pass_filenames: false + types: [python] diff --git a/pyproject.toml b/pyproject.toml index 5e85d8e..ffc45ed 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,6 +43,8 @@ dev-dependencies = [ "pytest-cov>=4.1.0", "respx>=0.20.2", "time-machine>=2.14.0", + # Development + "pre-commit>=3.7.0", ] [tool.hatch.version] diff --git a/requirements-dev.lock b/requirements-dev.lock index 5d8b825..a714f9d 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -16,6 +16,8 @@ certifi==2024.2.2 # via httpcore # via httpx # via requests +cfgv==3.4.0 + # via pre-commit charset-normalizer==3.3.2 # via requests click==8.1.7 @@ -27,6 +29,10 @@ colorama==0.4.6 coverage==7.4.3 # via coverage # via pytest-cov +distlib==0.3.8 + # via virtualenv +filelock==3.13.3 + # via virtualenv ghp-import==2.1.0 # via mkdocs griffe==0.41.3 @@ -38,6 +44,8 @@ httpcore==1.0.4 httpx==0.27.0 # via aiosalesforce # via respx +identify==2.5.35 + # via pre-commit idna==3.6 # via anyio # via httpx @@ -78,6 +86,8 @@ mkdocstrings-python==1.8.0 mypy==1.8.0 mypy-extensions==1.0.0 # via mypy +nodeenv==1.8.0 + # via pre-commit orjson==3.9.15 # via aiosalesforce packaging==23.2 @@ -90,8 +100,10 @@ pathspec==0.12.1 platformdirs==4.2.0 # via mkdocs # via mkdocstrings + # via virtualenv pluggy==1.4.0 # via pytest +pre-commit==3.7.0 pygments==2.17.2 # via mkdocs-material pymdown-extensions==10.7.1 @@ -107,6 +119,7 @@ python-dateutil==2.9.0.post0 # via time-machine pyyaml==6.0.1 # via mkdocs + # via pre-commit # via pymdown-extensions # via pyyaml-env-tag pyyaml-env-tag==0.1 @@ -127,5 +140,9 @@ typing-extensions==4.10.0 # via mypy urllib3==2.2.1 # via requests +virtualenv==20.25.1 + # via pre-commit watchdog==4.0.0 # via mkdocs +setuptools==69.2.0 + # via nodeenv