-
Notifications
You must be signed in to change notification settings - Fork 59
Closed
Description
Context:
A recent review thread discussed avoiding mutable defaults for the Conversation visualizer parameter. Our Ruff configuration on main does not currently enable rules that catch mutable defaults and related pitfalls.
Proposed Ruff rules to enable:
- B006 (mutable-argument-default)
- B008 (function-call-in-default-argument)
- B039 (mutable-contextvar-default)
- RUF012 (mutable-class-default)
Current state:
- pyproject.toml only selects: E, F, I, UP, ARG
- pre-commit runs
ruff checkwith project config - CI runs pre-commit; no additional ruff rules enabled
Quick local run on main with these rules:
- 20× B008 (function call in default argument)
- 8× RUF012 (mutable class default)
- 2× B006 (mutable argument default)
- 0× B039 (mutable ContextVar default)
Impact:
Enabling these will enforce best practices around default values and prevent subtle shared-state bugs.
Plan:
- Add these rules via
extend-selectin pyproject.toml - Land the config, then follow-up PRs to fix violations (or selectively allowlist safe patterns using
extend-immutable-callsfor B006/B008 where appropriate)
PR:
A PR enabling these rules has been prepared.
Metadata
Metadata
Assignees
Labels
No labels