Skip to content

Lint: silence B008 false positives for typer.Option / FastAPI Depends via ruff config #166

Closed

Description

@vsn411

Problem: ruff flags 18 B008 (function call in a default argument): 16 in src/secfoo/cli.py, 2 in src/secfoo/web/routes/assessments.py. These are false positives. typer.Option(...), typer.Argument(...) and FastAPI's Depends(...)/Query(...) are meant to be used as defaults.

Build: tell ruff these calls are safe, without rewriting every signature:

[tool.ruff.lint.flake8-bugbear]
extend-immutable-calls = ["typer.Option", "typer.Argument", "fastapi.Depends", "fastapi.Query", "fastapi.Form", "fastapi.File"]

Put this in the existing ruff config, and list only the calls that actually trigger the rule. If a flagged call is really mutable (such as a list or dict default), fix that one in code instead.

Where to look: the ruff config (pyproject.toml or ruff.toml), src/secfoo/cli.py, src/secfoo/web/routes/assessments.py.

Done when: ruff check . --select B008 is clean, no # noqa comments were added, and pytest tests passes.

Part of #114.

Activity

  1. added
    enhancement
    good first issue
    help wanted
    hackathon
    difficulty: low
    on Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    difficulty: lowenhancementgood first issuehackathonhelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions