diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 0000000..6b43096 --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,3 @@ +# Mass lint/format commits that add noise to git blame. +# Enable locally with: git config blame.ignoreRevsFile .git-blame-ignore-revs +38f3cce # Apply linters and formatters diff --git a/.gitignore b/.gitignore index 0dfef6f..4862965 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,5 @@ package-lock.json .* !.gitignore !.gitea/ +!.git-blame-ignore-revs +!.pre-commit-config.yaml diff --git a/lefthook.yml b/lefthook.yml new file mode 100644 index 0000000..d4a42c7 --- /dev/null +++ b/lefthook.yml @@ -0,0 +1,19 @@ +pre-commit: + parallel: true + commands: + ruff-check: + glob: "*.py" + run: .venv/bin/ruff check --fix {staged_files} + stage_fixed: true + ruff-format: + glob: "*.py" + run: .venv/bin/ruff format {staged_files} + stage_fixed: true + oxlint: + glob: "frontend/src/**" + run: npm --prefix frontend run lint + stage_fixed: true + oxfmt: + glob: "frontend/src/**" + run: npm --prefix frontend run format + stage_fixed: true diff --git a/pyproject.toml b/pyproject.toml index f4baccd..5382fb0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -63,6 +63,7 @@ gui = [ [dependency-groups] dev = [ "httpx>=0.28.1", + "lefthook>=2.1.14", "ruff>=0.15.14", "setuptools-scm>=8", ]