Skip to content
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
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ repos:
- id: mixed-line-ending
- id: name-tests-test
args: ["--pytest-test-first"]
- id: no-commit-to-branch
args: ["--branch", "main", "--pattern", "^versions/.*"]
always_run: true
# Restrict to pre-commit so a push (e.g. a release tag) isn't mistaken for a commit.
stages: [pre-commit]
- id: trailing-whitespace

- repo: https://github.com/pre-commit/pygrep-hooks
Expand Down
8 changes: 6 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"""Nox setup."""

import argparse
import os
import shutil
from enum import StrEnum, auto
from pathlib import Path
Expand Down Expand Up @@ -71,8 +72,11 @@ def lint(s: nox.Session, /) -> None:

@session(uv_groups=["lint"], reuse_venv=True)
def precommit(s: nox.Session, /) -> None:
"""Run prek."""
s.run("prek", "run", "--all-files", *s.posargs)
"""Run the pre-commit hooks (via prek)."""
# Not a real commit -- no-commit-to-branch would always fail here.
# Merge into any SKIP already set, rather than clobber it.
skip = ",".join(filter(None, [os.environ.get("SKIP"), "no-commit-to-branch"]))
s.run("prek", "run", "--all-files", *s.posargs, env={"SKIP": skip})


@session(uv_groups=["typecheck"], uv_extras=["all"], reuse_venv=True)
Expand Down
Loading