Skip to content

Commit 51de88c

Browse files
authored
Merge pull request #12510 from notatallshaw/update-ruff-config-to-latest
Update ruff config to latest
2 parents 811beab + 5ca52ff commit 51de88c

File tree

4 files changed

+14
-11
lines changed

4 files changed

+14
-11
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ repos:
2222
- id: black
2323

2424
- repo: https://github.com/astral-sh/ruff-pre-commit
25-
rev: v0.1.9
25+
rev: v0.2.0
2626
hooks:
2727
- id: ruff
2828
args: [--fix, --exit-non-zero-on-fix]

news/12510.trivial.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update ruff to 0.2.0 and update ruff config to reflect

noxfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
# fmt: off
1515
sys.path.append(".")
16-
from tools import release # isort:skip # noqa
16+
from tools import release # isort:skip
1717
sys.path.pop()
1818
# fmt: on
1919

pyproject.toml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -138,20 +138,23 @@ distlib = "https://bitbucket.org/pypa/distlib/raw/master/LICENSE.txt"
138138
webencodings = "https://github.com/SimonSapin/python-webencodings/raw/master/LICENSE"
139139

140140
[tool.ruff]
141+
src = ["src"]
142+
target-version = "py37"
143+
line-length = 88
141144
extend-exclude = [
142145
"_vendor",
143146
"./build",
144147
".scratch",
145148
"data",
146149
]
150+
151+
[tool.ruff.lint]
147152
ignore = [
148153
"B019",
149154
"B020",
150155
"B904", # Ruff enables opinionated warnings by default
151156
"B905", # Ruff enables opinionated warnings by default
152157
]
153-
target-version = "py37"
154-
line-length = 88
155158
select = [
156159
"ASYNC",
157160
"B",
@@ -170,22 +173,21 @@ select = [
170173
"UP032",
171174
]
172175

173-
[tool.ruff.isort]
174-
# We need to explicitly make pip "first party" as it's imported by code in
175-
# the docs and tests directories.
176-
known-first-party = ["pip"]
176+
[tool.ruff.lint.isort]
177+
# Explicitly make tests "first party" as it's not in the "src" directory
178+
known-first-party = ["tests"]
177179
known-third-party = ["pip._vendor"]
178180

179-
[tool.ruff.mccabe]
181+
[tool.ruff.lint.mccabe]
180182
max-complexity = 33 # default is 10
181183

182-
[tool.ruff.per-file-ignores]
184+
[tool.ruff.lint.per-file-ignores]
183185
"noxfile.py" = ["G"]
184186
"src/pip/_internal/*" = ["PERF203"]
185187
"tests/*" = ["B011"]
186188
"tests/unit/test_finder.py" = ["C414"]
187189

188-
[tool.ruff.pylint]
190+
[tool.ruff.lint.pylint]
189191
max-args = 15 # default is 5
190192
max-branches = 28 # default is 12
191193
max-returns = 13 # default is 6

0 commit comments

Comments
 (0)