From bbaaacaca0b61ed3f04ea2bab4b398fc66d71094 Mon Sep 17 00:00:00 2001 From: Michael Osthege Date: Thu, 3 Oct 2024 11:01:37 +0200 Subject: [PATCH] Add pre-commit configuration --- .github/workflows/pre-commit.yml | 14 ++++++++++++++ .pre-commit-config.yaml | 24 ++++++++++++++++++++++++ pyproject.toml | 2 ++ requirements-dev.txt | 3 ++- 4 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/pre-commit.yml create mode 100644 .pre-commit-config.yaml create mode 100644 pyproject.toml diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 0000000..65947d3 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,14 @@ +name: pre-commit + +on: + pull_request: + push: + branches: [main] + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + - uses: pre-commit/action@v3.0.1 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..6457f35 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,24 @@ +# Exclude some file types from automatic code style +exclude: \.(json|csv)$ +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.6.0 + hooks: + - id: check-merge-conflict + - id: check-toml + - id: check-yaml + - id: end-of-file-fixer + - id: trailing-whitespace +- repo: https://github.com/PyCQA/isort + rev: 5.13.2 + hooks: + - id: isort + name: isort +- repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.6.8 + hooks: + # Run the linter and fix simple issues automatically + - id: ruff + args: [ --fix ] + # Run the formatter. + - id: ruff-format diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..5d7bf33 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,2 @@ +[tool.isort] +profile = "black" diff --git a/requirements-dev.txt b/requirements-dev.txt index f9ddc40..f1f109b 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1 +1,2 @@ -pytest==8.3.3 \ No newline at end of file +pytest==8.3.3 +pre-commit