diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 864ce7d1..571846a5 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -3,6 +3,13 @@ name: Unit Tests on: [push, pull_request] jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 + - uses: pre-commit/action@v3.0.1 + test: runs-on: ubuntu-latest diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..485f3273 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,33 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: +- repo: https://github.com/PyCQA/isort + rev: 5.10.1 + hooks: + - id: isort + args: ["--profile", "black"] +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.1.0 + hooks: + - id: trailing-whitespace + files: ".*\\.py" + - id: check-added-large-files +- repo: https://github.com/wemake-services/dotenv-linter + rev: 0.3.0 # Use the ref you want to point at + hooks: + - id: dotenv-linter + files: ".env.example" +- repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.4.9 + hooks: + - id: ruff + args: [--fix] + - id: ruff-format + +# You can add your own hooks too. +# - repo: local +# hooks: +# - id: my_hook +# name: Some custom hook +# entry: ./.local_precommit_hooks/my_own_hook.sh +# language: script diff --git a/README.md b/README.md index 23a9173a..c18e92c5 100644 --- a/README.md +++ b/README.md @@ -15,3 +15,10 @@ macOS and Linux: `source venv/bin/activate` Run `tox` # How to run the unit tests - Navigate to the project's root directory and run `python -m pytest` + +# Using pre-commit for commit checks + +``` +pip install pre-commit +pre-commit install +``` \ No newline at end of file