Repository navigation
chore(lint): treat typer.Option and fastapi.Form as immutable for B008 - #184
Merged
vsn411 merged 2 commits intoNov 21, 2026
Conversation
Co-authored-by: gitranks[bot] <198371943+gitranks[bot]@users.noreply.github.com>
Collaborator
|
Thanks, and welcome! I checked this with ruff 0.17.6. Without the config there are exactly the 18 B008 findings (16 No changes needed from my side. I've approved the CI run, and once it's green this is ready to merge. |
Leaderboard update
onetwothird now has 3 points (rank #13). 22 more to reach Bronze. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #166
What does this change, and why?
ruff flags 18
B008findings (function call in an argument default): 16 fortyper.Option(...)insrc/secfoo/cli.pyand 2 for FastAPI'sForm(...)insrc/secfoo/web/routes/assessments.py. Those calls are meant to be used as parameter defaults — they describe the parameter rather than create shared mutable state — so these are false positives.The repo had no ruff configuration yet, so this adds a
[tool.ruff.lint.flake8-bugbear]section topyproject.tomlwithextend-immutable-calls = ["typer.Option", "fastapi.Form"]. Only the two calls that actually trigger the rule are listed (notyper.Argument,DependsorQueryusages are flagged today). No signatures were rewritten and no# noqacomments were added; none of the flagged defaults is genuinely mutable (Form(default_factory=list)builds a new list per request).ruff check . --select B008is now clean, and the overallruff check .count drops from 142 to 124 — exactly those 18. A newtests/test_lint_config.pyrunsruff check src --select B008so the setting can't silently regress (it skips if ruff isn't installed).This pull request was written by an AI agent (Claude Opus).
Testing
pytest testspassesruff check .passespytest tests: 1909 passed locally on Windows with 18 deselected — those 18 fail identically onmainwithout this change (Windows-only signal/path behaviour and the optional mermaid bundle), so CI on Linux should be green.ruff check .still reports the pre-existing, non-blocking backlog (124 findings, none B008), so that box is left unticked.