Skip to content

Commit

Permalink
Merge pull request pypa#12510 from notatallshaw/update-ruff-config-to…
Browse files Browse the repository at this point in the history
…-latest

Update ruff config to latest
  • Loading branch information
sbidoul authored Feb 5, 2024
2 parents 811beab + 5ca52ff commit 51de88c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ repos:
- id: black

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.9
rev: v0.2.0
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
1 change: 1 addition & 0 deletions news/12510.trivial.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update ruff to 0.2.0 and update ruff config to reflect
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

# fmt: off
sys.path.append(".")
from tools import release # isort:skip # noqa
from tools import release # isort:skip
sys.path.pop()
# fmt: on

Expand Down
20 changes: 11 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -138,20 +138,23 @@ distlib = "https://bitbucket.org/pypa/distlib/raw/master/LICENSE.txt"
webencodings = "https://github.com/SimonSapin/python-webencodings/raw/master/LICENSE"

[tool.ruff]
src = ["src"]
target-version = "py37"
line-length = 88
extend-exclude = [
"_vendor",
"./build",
".scratch",
"data",
]

[tool.ruff.lint]
ignore = [
"B019",
"B020",
"B904", # Ruff enables opinionated warnings by default
"B905", # Ruff enables opinionated warnings by default
]
target-version = "py37"
line-length = 88
select = [
"ASYNC",
"B",
Expand All @@ -170,22 +173,21 @@ select = [
"UP032",
]

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

[tool.ruff.mccabe]
[tool.ruff.lint.mccabe]
max-complexity = 33 # default is 10

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"noxfile.py" = ["G"]
"src/pip/_internal/*" = ["PERF203"]
"tests/*" = ["B011"]
"tests/unit/test_finder.py" = ["C414"]

[tool.ruff.pylint]
[tool.ruff.lint.pylint]
max-args = 15 # default is 5
max-branches = 28 # default is 12
max-returns = 13 # default is 6
Expand Down

0 comments on commit 51de88c

Please sign in to comment.