From 425e4f5cead8c4efc8de158ef90a2ae4bd11b5c2 Mon Sep 17 00:00:00 2001 From: vyuroshchin <> Date: Sat, 7 Feb 2026 23:08:46 +0300 Subject: [PATCH] add FURB ruff rule --- fastapi/routing.py | 4 +--- pyproject.toml | 17 +++++++++-------- scripts/doc_parsing_utils.py | 2 +- uv.lock | 8 ++++---- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/fastapi/routing.py b/fastapi/routing.py index 0b4d28873..ef99992f8 100644 --- a/fastapi/routing.py +++ b/fastapi/routing.py @@ -438,9 +438,7 @@ def get_request_handler( } # If status_code was set, use it, otherwise use the default from the # response class, in the case of redirect it's 307 - current_status_code = ( - status_code if status_code else solved_result.response.status_code - ) + current_status_code = status_code or solved_result.response.status_code if current_status_code is not None: response_args["status_code"] = current_status_code if solved_result.response.status_code: diff --git a/pyproject.toml b/pyproject.toml index 4895c2d34..7fdf529dd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -152,7 +152,7 @@ docs = [ ] docs-tests = [ "httpx >=0.23.0,<1.0.0", - "ruff >=0.14.14", + "ruff >=0.15.0", ] github-actions = [ "httpx >=0.27.0,<1.0.0", @@ -288,13 +288,14 @@ show_contexts = true [tool.ruff.lint] select = [ - "E", # pycodestyle errors - "W", # pycodestyle warnings - "F", # pyflakes - "I", # isort - "B", # flake8-bugbear - "C4", # flake8-comprehensions - "UP", # pyupgrade + "E", # pycodestyle errors + "W", # pycodestyle warnings + "F", # pyflakes + "I", # isort + "B", # flake8-bugbear + "C4", # flake8-comprehensions + "UP", # pyupgrade + "FURB" # refurb ] ignore = [ "E501", # line too long, handled by black diff --git a/scripts/doc_parsing_utils.py b/scripts/doc_parsing_utils.py index 79f2e9ec0..d38d30c0f 100644 --- a/scripts/doc_parsing_utils.py +++ b/scripts/doc_parsing_utils.py @@ -594,7 +594,7 @@ def replace_multiline_code_block( ) block_language = block_a["lang"].lower() - if block_language in {"mermaid"}: + if block_language == "mermaid": if block_a != block_b: print( f"Skipping mermaid code block replacement (lines {start_line}-{end_line_no}). " diff --git a/uv.lock b/uv.lock index 9a807f8b4..5119b6001 100644 --- a/uv.lock +++ b/uv.lock @@ -1587,7 +1587,7 @@ dev = [ { name = "pytest-codspeed", specifier = ">=4.2.0" }, { name = "python-slugify", specifier = ">=8.0.4" }, { name = "pyyaml", specifier = ">=5.3.1,<7.0.0" }, - { name = "ruff", specifier = ">=0.14.14" }, + { name = "ruff", specifier = ">=0.15.0" }, { name = "sqlmodel", specifier = ">=0.0.31" }, { name = "strawberry-graphql", specifier = ">=0.200.0,<1.0.0" }, { name = "typer", specifier = ">=0.21.1" }, @@ -1610,12 +1610,12 @@ docs = [ { name = "pillow", specifier = ">=11.3.0" }, { name = "python-slugify", specifier = ">=8.0.4" }, { name = "pyyaml", specifier = ">=5.3.1,<7.0.0" }, - { name = "ruff", specifier = ">=0.14.14" }, + { name = "ruff", specifier = ">=0.15.0" }, { name = "typer", specifier = ">=0.21.1" }, ] docs-tests = [ { name = "httpx", specifier = ">=0.23.0,<1.0.0" }, - { name = "ruff", specifier = ">=0.14.14" }, + { name = "ruff", specifier = ">=0.15.0" }, ] github-actions = [ { name = "httpx", specifier = ">=0.27.0,<1.0.0" }, @@ -1639,7 +1639,7 @@ tests = [ { name = "pytest", specifier = ">=7.1.3,<9.0.0" }, { name = "pytest-codspeed", specifier = ">=4.2.0" }, { name = "pyyaml", specifier = ">=5.3.1,<7.0.0" }, - { name = "ruff", specifier = ">=0.14.14" }, + { name = "ruff", specifier = ">=0.15.0" }, { name = "sqlmodel", specifier = ">=0.0.31" }, { name = "strawberry-graphql", specifier = ">=0.200.0,<1.0.0" }, { name = "types-orjson", specifier = ">=3.6.2" },