From fe2cd2c5bf688877b9e580fd458d84235622217e Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sat, 22 Mar 2025 23:25:34 +0100 Subject: [PATCH 1/2] Add pre-commit --- .pre-commit-config.yaml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..701341c --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,36 @@ +# Learn more about this config here: https://pre-commit.com/ + +# To enable these pre-commit hooks run: +# `pipx install pre-commit` or `brew install pre-commit` +# Then in the project root directory run `pre-commit install` + +repos: + - repo: https://github.com/codespell-project/codespell + rev: v2.4.1 + hooks: + - id: codespell + args: + - --ignore-words-list=alse,ons + additional_dependencies: + - tomli + + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.11.2 + hooks: + - id: ruff + - id: ruff-format + + - repo: https://github.com/pycqa/flake8 + rev: 7.1.2 + hooks: + - id: flake8 + + - repo: https://github.com/tox-dev/pyproject-fmt + rev: v2.5.1 + hooks: + - id: pyproject-fmt + + - repo: https://github.com/abravalheri/validate-pyproject + rev: v0.24.1 + hooks: + - id: validate-pyproject From bf40107f7767f8306e03f2a0bb0747795d4f4fb7 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sat, 22 Mar 2025 23:27:59 +0100 Subject: [PATCH 2/2] Create pre-commit.yml --- .github/workflows/pre-commit.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/pre-commit.yml diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 0000000..1295d46 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,19 @@ +# https://pre-commit.com +# https://github.com/pre-commit/action +# This GitHub Action assumes that the repo contains a valid .pre-commit-config.yaml file. +# Using pre-commit.ci is even better that using GitHub Actions for pre-commit. +name: pre-commit +on: + pull_request: + push: + branches: [main] + workflow_dispatch: +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: 3.x + - uses: pre-commit/action@v3.0.1