diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5f06add1eb3..b932b146f18 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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] diff --git a/news/12510.trivial.rst b/news/12510.trivial.rst new file mode 100644 index 00000000000..d41d5425b56 --- /dev/null +++ b/news/12510.trivial.rst @@ -0,0 +1 @@ +Update ruff to 0.2.0 and update ruff config to reflect diff --git a/noxfile.py b/noxfile.py index 878dbbd0ad6..34430e30077 100644 --- a/noxfile.py +++ b/noxfile.py @@ -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 diff --git a/pyproject.toml b/pyproject.toml index 7496a08ee2c..2da7793a026 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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", @@ -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