Skip to content

Expand ruff lint scope beyond hashview/ to tests, agent, and migrations #437

Description

@bandrel

Summary

CI's lint job only runs ruff check hashview/ hashview.py (.github/workflows/lint.yml), and the pre-push hook mirrors that scope. Everything else in the repo is unlinted: running ruff check . (ruff 0.9.7, same version as CI) on v0.8.3-dev reports 212 violations, of which 105 are auto-fixable with --fix.

Breakdown

By location:

Path Violations
tests/ 188
install/hashview-agent/ 17
migrations/env.py 4
setup.py 3

Top rules:

Rule Count Notes
E702 multiple-statements-on-one-line 77 mostly the user = _admin(); _login(client, user) test idiom — could instead be allowed via per-file-ignores for tests/
I001 unsorted-imports 60 auto-fixable
F401 unused-import 38 auto-fixable
UP015 redundant-open-modes 9 auto-fixable
F841 unused-variable 9 auto-fixable
E402 import-not-at-top 5 some are intentional (agent config side effects, conftest stubs) — needs # noqa or per-file-ignores
E741 ambiguous-variable-name 3 manual (l in comprehensions)
E722 bare-except 1 manual, in hashview-agent.py
misc UP/B/F541 10 mostly auto-fixable

Proposed approach

Single mechanical cleanup PR:

  1. Run ruff check . --fix for the ~105 autofixes.
  2. Hand-fix the small remainder (E741, E722, B007, B017, F841 leftovers).
  3. Decide policy on E702 in tests: either fix all 77 or add per-file-ignores = { "tests/**" = ["E702"] } in pyproject.toml if the semicolon seed/login idiom is preferred.
  4. Add # noqa: E402 where the late import is deliberate (agent's post-config imports, migrations/env.py, tests/agent_unit/conftest.py).
  5. Widen CI to ruff check . in lint.yml and update the pre-push hook to match.

Keeping it in its own PR keeps the diff mechanical and out of the way of the in-flight feature branches (#431/#436 both touch many of the same test files).

🤖 Generated with Claude Code

Activity

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions