Skip to content

Commit eb5b49a

Browse files
committed
Add pre-commit
1 parent 705e4a0 commit eb5b49a

4 files changed

Lines changed: 40 additions & 1 deletion

File tree

.pre-commit-config.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.6.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: check-merge-conflict
7+
- id: check-toml
8+
- id: check-yaml
9+
- id: end-of-file-fixer
10+
- repo: https://github.com/pycqa/isort
11+
rev: 5.13.2
12+
hooks:
13+
- id: isort
14+
- repo: https://github.com/astral-sh/ruff-pre-commit
15+
rev: v0.4.10
16+
hooks:
17+
- id: ruff
18+
- id: ruff-format
19+
- repo: local
20+
hooks:
21+
- id: mypy
22+
name: mypy
23+
entry: mypy
24+
language: system
25+
types: [ python ]
26+
pass_filenames: true

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,7 @@ you can install all development dependencies through
7272
$ pip install -r requirements-dev.txt
7373

7474
After which all tools (`ruff`, `isort`, `pytest`, etc.) will be available.
75+
76+
### pre-commit
77+
78+
If this suits your workflow, you can install the pre-commit configuration using `pre-commit install` which will automatically check some things before allowing you to commit (`pre-commit` is included in the dev dependencies).

docs/source/conf.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,13 @@
44
# list see the documentation:
55
# https://www.sphinx-doc.org/en/master/usage/configuration.html
66

7-
import importlib.metadata
7+
# isort: skip_file
8+
# mypy: ignore-errors
9+
# ruff: noqa
10+
811
import datetime
12+
import importlib.metadata
13+
914

1015
# -- Path setup --------------------------------------------------------------
1116

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,10 @@ unfixable = [
152152
"B", # Avoid trying to fix flake8-bugbear (`B`) violations.
153153
]
154154

155+
exclude = [
156+
"docs/**/*.py",
157+
]
158+
155159
[tool.ruff.lint.pydocstyle]
156160
convention = "pep257"
157161

0 commit comments

Comments
 (0)