From f5739d736695cc9e955ed832634590543469a91f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Gajdu=C5=A1ek?= Date: Thu, 29 Aug 2024 11:01:35 +0300 Subject: [PATCH] Fix ruff deprecation warnings (#1212) Fixing: ``` $ ruff check . warning: The top-level linter settings are deprecated in favour of their counterparts in the `lint` section. Please update the following options in `pyproject.toml`: - 'fixable' -> 'lint.fixable' - 'ignore' -> 'lint.ignore' - 'select' -> 'lint.select' - 'flake8-pytest-style' -> 'lint.flake8-pytest-style' - 'isort' -> 'lint.isort' - 'mccabe' -> 'lint.mccabe' - 'per-file-ignores' -> 'lint.per-file-ignores' warning: `PGH001` has been remapped to `S307`. warning: `TRY200` has been remapped to `B904`. ``` I removed `PGH001` as `S307` is in the `select` section already (cherry picked from commit 5d8d770b8bb46ca8a338f6ddb4c4cfcca2bc80eb) --- pyproject.toml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index d668c4e3..34903ac3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,6 +19,8 @@ exclude = ''' [tool.ruff] target-version = "py311" + +[tool.ruff.lint] fixable = ["ALL"] select = [ @@ -74,7 +76,7 @@ select = [ "T100", # Trace found: {name} used "T20", # flake8-print "TRY004", # Prefer TypeError exception for invalid type - "TRY200", # Use raise from to specify exception cause + "B904", # Use raise from to specify exception cause "TRY302", # Remove exception handler; error is immediately re-raised "PLR0911", # Too many return statements ({returns} > {max_returns}) "PLR0912", # Too many branches ({branches} > {max_branches}) @@ -93,27 +95,26 @@ ignore = [ "D407", # Section name underlining "E501", # line too long "E731", # do not assign a lambda expression, use a def - "PGH001", # No builtin eval() allowed "PLR0913", # Too many arguments to function call ({c_args} > {max_args}) "PLW0603", # Using the global statement "RUF012", # Mutable class attributes should be annotated with typing.ClassVar "D107", # Missing docstring in __init__ ] -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] # Allow pprint for docs formatting "docs/create_*.py" = ["T203"] -[tool.ruff.flake8-pytest-style] +[tool.ruff.lint.flake8-pytest-style] fixture-parentheses = false -[tool.ruff.isort] +[tool.ruff.lint.isort] force-sort-within-sections = true known-first-party = [ "broker", ] combine-as-imports = true -[tool.ruff.mccabe] +[tool.ruff.lint.mccabe] max-complexity = 25