From 373ec4f7c140bd662691ed5f59c03a51441844bc Mon Sep 17 00:00:00 2001 From: TiaTuinstra Date: Fri, 24 Oct 2025 20:42:56 +0000 Subject: [PATCH 1/2] pre-commit for local and github actions formatting --- .github/workflows/pre-commit.yaml | 32 +++++++++++++++++++++++++++++++ .pre-commit-config.yaml | 7 +++++++ pyproject.toml | 1 + 3 files changed, 40 insertions(+) create mode 100644 .github/workflows/pre-commit.yaml create mode 100644 .pre-commit-config.yaml diff --git a/.github/workflows/pre-commit.yaml b/.github/workflows/pre-commit.yaml new file mode 100644 index 0000000..e03e6eb --- /dev/null +++ b/.github/workflows/pre-commit.yaml @@ -0,0 +1,32 @@ +name: Pre-commit Checks + +on: + push: + paths: + - '**.py' + - .pre-commit-config.yaml + pull_request: + paths: + - '**.py' + - .pre-commit-config.yaml + +jobs: + pre-commit: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pre-commit ruff + + - name: Run pre-commit on changed files + run: pre-commit run --all-files diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..39f5579 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,7 @@ +repos: + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.13.0 + hooks: + - id: ruff-check + args: [--fix] # Lint and auto-fix + - id: ruff-format # Format code like black \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index e24ce9c..c3f8d90 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,4 +13,5 @@ dependencies = [ [dependency-groups] dev = [ "pytest", + "pre-commit", ] From dee8045c4ad4e7052d8783721adcab50927dd018 Mon Sep 17 00:00:00 2001 From: TiaTuinstra Date: Fri, 24 Oct 2025 20:49:52 +0000 Subject: [PATCH 2/2] removing pre-commit from github actions; just local --- .github/workflows/pre-commit.yaml | 32 ------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 .github/workflows/pre-commit.yaml diff --git a/.github/workflows/pre-commit.yaml b/.github/workflows/pre-commit.yaml deleted file mode 100644 index e03e6eb..0000000 --- a/.github/workflows/pre-commit.yaml +++ /dev/null @@ -1,32 +0,0 @@ -name: Pre-commit Checks - -on: - push: - paths: - - '**.py' - - .pre-commit-config.yaml - pull_request: - paths: - - '**.py' - - .pre-commit-config.yaml - -jobs: - pre-commit: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install pre-commit ruff - - - name: Run pre-commit on changed files - run: pre-commit run --all-files