Skip to content

Commit d602b90

Browse files
committed
chore: updates blacken session with deprecation warning re: ruff
1 parent 9a35d35 commit d602b90

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

packages/google-cloud-spanner/noxfile.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,23 +116,34 @@ def lint(session):
116116
Returns a failure if the linters find linting errors or sufficiently
117117
serious code quality issues.
118118
"""
119-
session.install(FLAKE8_VERSION, BLACK_VERSION)
119+
session.install(FLAKE8_VERSION, RUFF_VERSION)
120+
# Check formatting
120121
session.run(
121-
"black",
122+
"ruff",
123+
"format",
122124
"--check",
125+
f"--target-version=py{ALL_PYTHON[0].replace('.', '')}",
126+
"--line-length=88",
123127
*LINT_PATHS,
124128
)
129+
125130
session.run("flake8", "google", "tests")
126131

127132

128133
# Use a python runtime which is available in the owlbot post processor here
129134
# https://github.com/googleapis/synthtool/blob/master/docker/owlbot/python/Dockerfile
130135
@nox.session(python=DEFAULT_PYTHON_VERSION)
131136
def blacken(session):
132-
"""Run black. Format code to uniform standard."""
133-
session.install(BLACK_VERSION)
137+
"""(Deprecated) Legacy session. Please use 'nox -s format'."""
138+
session.log(
139+
"WARNING: The 'blacken' session is deprecated and will be removed in a future release. Please use 'nox -s format' in the future."
140+
)
141+
session.install(RUFF_VERSION)
134142
session.run(
135-
"black",
143+
"ruff",
144+
"format",
145+
f"--target-version=py{ALL_PYTHON[0].replace('.', '')}",
146+
"--line-length=88",
136147
*LINT_PATHS,
137148
)
138149

0 commit comments

Comments
 (0)