From 1aeaf08b3d74f8ee54dd5f2a9e2e206fc3d467e8 Mon Sep 17 00:00:00 2001 From: Fayaz Yusuf Khan Date: Sun, 8 Jun 2025 12:50:37 -0400 Subject: [PATCH 1/2] Add pre-commit configuration --- .gitignore | 1 - .pre-commit-config.yaml | 11 +++++++++++ requirements-test.txt | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.gitignore b/.gitignore index 73df3ab..fce99d7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ uv.lock -.pre-commit-config.yaml .eggs .env *~ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..aa2e096 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,11 @@ +# 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 diff --git a/requirements-test.txt b/requirements-test.txt index b8425ec..07d2fbc 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,3 +1,3 @@ pytest pytest-cov -hypothesis \ No newline at end of file +hypothesis From 2a74aae3e503fd7a1bc52cfc45141c3e7f3a2784 Mon Sep 17 00:00:00 2001 From: Fayaz Yusuf Khan Date: Sun, 8 Jun 2025 17:07:37 -0400 Subject: [PATCH 2/2] Add flake8 to pre-commit hooks --- .flake8 | 9 +++++++++ .pre-commit-config.yaml | 4 ++++ noxfile.py | 9 +++------ 3 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 .flake8 diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..0c9d6d8 --- /dev/null +++ b/.flake8 @@ -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 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index aa2e096..a9d22c7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,3 +9,7 @@ repos: exclude: '^.*\.svg$' - id: check-yaml - id: check-added-large-files +- repo: https://github.com/pycqa/flake8 + rev: '7.2.0' + hooks: + - id: flake8 diff --git a/noxfile.py b/noxfile.py index ce2bc04..8fe9295 100644 --- a/noxfile.py +++ b/noxfile.py @@ -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():