Skip to content

Commit ae89cda

Browse files
authored
Add pre-commit hooks (#103)
* Add pre-commit configuration * Add flake8 to pre-commit hooks
1 parent 95e5fec commit ae89cda

File tree

5 files changed

+28
-8
lines changed

5 files changed

+28
-8
lines changed

.flake8

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[flake8]
2+
extend-exclude = .venv
3+
statistics = True
4+
count = True
5+
show-source = True
6+
# The GitHub editor is 127 chars wide
7+
max-line-length = 127
8+
# Ignore valid SQLAlchemy NULL query syntax
9+
extend-ignore = E711

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
uv.lock
2-
.pre-commit-config.yaml
32
.eggs
43
.env
54
*~

.pre-commit-config.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v5.0.0
6+
hooks:
7+
- id: trailing-whitespace
8+
- id: end-of-file-fixer
9+
exclude: '^.*\.svg$'
10+
- id: check-yaml
11+
- id: check-added-large-files
12+
- repo: https://github.com/pycqa/flake8
13+
rev: '7.2.0'
14+
hooks:
15+
- id: flake8

noxfile.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,9 @@ def lint(session):
5757
"""Run flake8."""
5858
session.install("flake8")
5959
# stop the linter if there are Python syntax errors or undefined names
60-
session.run(
61-
"flake8", ".", "--count", "--select=E9,F63,F7,F82", "--show-source", "--statistics", "--extend-exclude", ".venv")
62-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
63-
session.run(
64-
"flake8", ".", "--count", "--exit-zero", "--max-complexity=10", "--extend-ignore=E711",
65-
"--max-line-length=127", "--statistics", "--extend-exclude", ".venv")
60+
session.run("flake8", "--select=E9,F63,F7,F82", "--show-source")
61+
# exit-zero treats all errors as warnings
62+
session.run("flake8", "--exit-zero", "--max-complexity=10")
6663

6764

6865
def parametrize_test_versions():

requirements-test.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
pytest
22
pytest-cov
3-
hypothesis
3+
hypothesis

0 commit comments

Comments
 (0)