From 4eb6540e593a054ec72b09675065a7efb64214e9 Mon Sep 17 00:00:00 2001 From: Jonathan Sick Date: Mon, 27 Jul 2026 16:06:23 -0400 Subject: [PATCH] Scope PLR0917 to exclude FastAPI handlers ruff 0.16.0 stabilized PLR0917 (too-many-positional-arguments) out of preview. Since ruff-shared.toml selects ALL, it now fires on every FastAPI route handler, which legitimately takes more than five parameters (path and query parameters plus Depends injections) and is only ever called by FastAPI itself, by keyword. Add PLR0917 to the existing handlers per-file-ignores rather than the global ignore list, so the rule keeps firing on ordinary internal APIs. --- .../fastapi_safir_app/example-uws/ruff-shared.toml | 2 ++ project_templates/fastapi_safir_app/example/ruff-shared.toml | 2 ++ .../fastapi_safir_app/{{cookiecutter.name}}/ruff-shared.toml | 2 ++ 3 files changed, 6 insertions(+) diff --git a/project_templates/fastapi_safir_app/example-uws/ruff-shared.toml b/project_templates/fastapi_safir_app/example-uws/ruff-shared.toml index 36d8097e..1ce4e294 100644 --- a/project_templates/fastapi_safir_app/example-uws/ruff-shared.toml +++ b/project_templates/fastapi_safir_app/example-uws/ruff-shared.toml @@ -99,9 +99,11 @@ select = ["ALL"] ] "src/*/handlers/**" = [ "D103", # FastAPI handlers should not have docstrings + "PLR0917", # FastAPI injects handler arguments by keyword, not position ] "*/src/*/handlers/**" = [ "D103", # FastAPI handlers should not have docstrings + "PLR0917", # FastAPI injects handler arguments by keyword, not position ] "tests/**" = [ "C901", # tests are allowed to be complex, sometimes that's convenient diff --git a/project_templates/fastapi_safir_app/example/ruff-shared.toml b/project_templates/fastapi_safir_app/example/ruff-shared.toml index 36d8097e..1ce4e294 100644 --- a/project_templates/fastapi_safir_app/example/ruff-shared.toml +++ b/project_templates/fastapi_safir_app/example/ruff-shared.toml @@ -99,9 +99,11 @@ select = ["ALL"] ] "src/*/handlers/**" = [ "D103", # FastAPI handlers should not have docstrings + "PLR0917", # FastAPI injects handler arguments by keyword, not position ] "*/src/*/handlers/**" = [ "D103", # FastAPI handlers should not have docstrings + "PLR0917", # FastAPI injects handler arguments by keyword, not position ] "tests/**" = [ "C901", # tests are allowed to be complex, sometimes that's convenient diff --git a/project_templates/fastapi_safir_app/{{cookiecutter.name}}/ruff-shared.toml b/project_templates/fastapi_safir_app/{{cookiecutter.name}}/ruff-shared.toml index 36d8097e..1ce4e294 100644 --- a/project_templates/fastapi_safir_app/{{cookiecutter.name}}/ruff-shared.toml +++ b/project_templates/fastapi_safir_app/{{cookiecutter.name}}/ruff-shared.toml @@ -99,9 +99,11 @@ select = ["ALL"] ] "src/*/handlers/**" = [ "D103", # FastAPI handlers should not have docstrings + "PLR0917", # FastAPI injects handler arguments by keyword, not position ] "*/src/*/handlers/**" = [ "D103", # FastAPI handlers should not have docstrings + "PLR0917", # FastAPI injects handler arguments by keyword, not position ] "tests/**" = [ "C901", # tests are allowed to be complex, sometimes that's convenient