Skip to content

Add pre-commit hooks #103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[flake8]
extend-exclude = .venv
statistics = True
count = True
show-source = True
# The GitHub editor is 127 chars wide
max-line-length = 127
# Ignore valid SQLAlchemy NULL query syntax
extend-ignore = E711
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
uv.lock
.pre-commit-config.yaml
.eggs
.env
*~
Expand Down
15 changes: 15 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
exclude: '^.*\.svg$'
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/pycqa/flake8
rev: '7.2.0'
hooks:
- id: flake8
9 changes: 3 additions & 6 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,9 @@ def lint(session):
"""Run flake8."""
session.install("flake8")
# stop the linter if there are Python syntax errors or undefined names
session.run(
"flake8", ".", "--count", "--select=E9,F63,F7,F82", "--show-source", "--statistics", "--extend-exclude", ".venv")
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
session.run(
"flake8", ".", "--count", "--exit-zero", "--max-complexity=10", "--extend-ignore=E711",
"--max-line-length=127", "--statistics", "--extend-exclude", ".venv")
session.run("flake8", "--select=E9,F63,F7,F82", "--show-source")
# exit-zero treats all errors as warnings
session.run("flake8", "--exit-zero", "--max-complexity=10")


def parametrize_test_versions():
Expand Down
2 changes: 1 addition & 1 deletion requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pytest
pytest-cov
hypothesis
hypothesis