Skip to content

Commit a2272b0

Browse files
committed
ch09: use pre-commit in lint session
1 parent 0881ec1 commit a2272b0

File tree

1 file changed

+5
-4
lines changed
  • chapter09-linting-with-ruff-and-pre-commit

1 file changed

+5
-4
lines changed

chapter09-linting-with-ruff-and-pre-commit/noxfile.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import nox
1111

1212
nox.options.error_on_external_run = True
13-
nox.options.sessions = ["tests"]
13+
nox.options.sessions = ["lint", "tests"]
1414

1515

1616
def constraints(session):
@@ -50,9 +50,10 @@ def build(session):
5050

5151
@nox.session
5252
def lint(session):
53-
"""Lint using Ruff."""
54-
session.install("ruff")
55-
session.run("ruff", "check")
53+
"""Lint using pre-commit."""
54+
options = ["--all-files", "--show-diff-on-fail"]
55+
session.install("pre-commit")
56+
session.run("pre-commit", "run", *options, *session.posargs)
5657

5758

5859
def install_coverage_pth(session):

0 commit comments

Comments
 (0)