Skip to content

Commit ed3acdd

Browse files
chalmerloweparthea
authored andcommitted
chore: updates blacken session with deprecation warning re: ruff
1 parent bff166f commit ed3acdd

1 file changed

Lines changed: 16 additions & 5 deletions

File tree

packages/google-cloud-spanner/noxfile.py

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

128133

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

0 commit comments

Comments
 (0)