Skip to content

Ruff rule set too narrow — missing I (import sort), B (bugbear), UP (pyupgrade) #135

Description

@codeforester

Problem

pyproject.toml:106 configures Ruff with a minimal rule set:

[tool.ruff.lint]
select = ["E4", "E7", "E9", "F"]

This covers only basic pyflakes (F) and a narrow slice of pycodestyle (E4, E7, E9). Missing rule groups that directly affect code quality in a library:

  • I (isort) — import sorting. Currently imports in some modules are inconsistently ordered. Enforcing this reduces review noise and keeps files readable.
  • B (flake8-bugbear) — catches common bugs: mutable default arguments, loop variable capture, assert misuse, bare except clauses. Especially relevant in a framework where consumers will copy patterns.
  • UP (pyupgrade) — enforces idiomatic Python 3.10+ syntax. Since requires-python = ">=3.10", pyupgrade can enforce X | Y unions, match where applicable, and other modern syntax that adopters will copy.

Fix

Expand select to:

[tool.ruff.lint]
select = ["E4", "E7", "E9", "F", "I", "B", "UP"]
ignore = ["E501"]  # keep existing line-length exclusion

Run ruff check --fix lib/python/base_cli/ to auto-fix safe violations before committing. Review B violations manually — some may require logic changes.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status
Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions