Add pre-commit configuration

This commit is contained in:
Michael Osthege 2024-10-03 11:01:37 +02:00 committed by Andreas
parent 8595b91692
commit bbaaacaca0
4 changed files with 42 additions and 1 deletions

14
.github/workflows/pre-commit.yml vendored Normal file
View File

@ -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

24
.pre-commit-config.yaml Normal file
View File

@ -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

2
pyproject.toml Normal file
View File

@ -0,0 +1,2 @@
[tool.isort]
profile = "black"

View File

@ -1 +1,2 @@
pytest==8.3.3
pytest==8.3.3
pre-commit