Skip to content

Commit 9b249aa

Browse files
chore: switch to ruff linter
1 parent ba4e5a8 commit 9b249aa

2 files changed

Lines changed: 15 additions & 36 deletions

File tree

noxfile.py

Lines changed: 9 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020

2121
import nox
2222

23-
BLACK_VERSION = "black==24.10.0"
24-
ISORT_VERSION = "isort==5.13.2"
2523

2624
LINT_PATHS = ["google", "tests", "noxfile.py"]
2725

@@ -36,32 +34,16 @@ def lint(session):
3634
"""
3735
session.install("-r", "requirements.txt")
3836
session.install(
39-
"flake8",
40-
"flake8-annotations",
37+
"ruff",
4138
"mypy",
42-
BLACK_VERSION,
43-
ISORT_VERSION,
4439
"twine",
4540
"build",
4641
"importlib_metadata==7.2.1",
4742
)
4843
session.run(
49-
"isort",
50-
"--fss",
51-
"--check-only",
52-
"--diff",
53-
"--profile=black",
54-
"--force-single-line-imports",
55-
"--dont-order-by-type",
56-
"--single-line-exclusions=typing",
57-
"-w=88",
58-
*LINT_PATHS,
59-
)
60-
session.run("black", "--check", "--diff", *LINT_PATHS)
61-
session.run(
62-
"flake8",
63-
"google",
64-
"tests",
44+
"ruff",
45+
"check",
46+
*LINT_PATHS,
6547
)
6648
session.run(
6749
"mypy",
@@ -75,28 +57,19 @@ def lint(session):
7557
session.run("python", "-m", "build", "--sdist")
7658
session.run("twine", "check", "--strict", "dist/*")
7759

78-
7960
@nox.session()
8061
def format(session):
8162
"""
82-
Run isort to sort imports. Then run black
63+
Run isort to sort imports. Then run black
8364
to format code to uniform standard.
8465
"""
85-
session.install(BLACK_VERSION, ISORT_VERSION)
66+
session.install("ruff")
8667
# Use the --fss option to sort imports using strict alphabetical order.
8768
# See https://pycqa.github.io/isort/docs/configuration/options.html#force-sort-within-sectionss
8869
session.run(
89-
"isort",
90-
"--fss",
91-
"--profile=black",
92-
"--force-single-line-imports",
93-
"--dont-order-by-type",
94-
"--single-line-exclusions=typing",
95-
"-w=88",
96-
*LINT_PATHS,
97-
)
98-
session.run(
99-
"black",
70+
"ruff",
71+
"check",
72+
"--fix",
10073
*LINT_PATHS,
10174
)
10275

pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,9 @@ exclude = ['docs/*', 'samples/*']
8282

8383
[tool.pytest.ini_options]
8484
asyncio_mode = "auto"
85+
86+
[tool.ruff]
87+
line-length = 88
88+
89+
[tool.ruff.format]
90+
quote-style = "double"

0 commit comments

Comments
 (0)