hashview / hashview/hashview

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

Open
#437 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement Tests
Dominant language
Python
Stars
399
Forks
52
Avg merge
21h 39m
Merged PRs (30d)
79

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with .github/workflows/lint.yml, the pre-push hook, and pyproject.toml, then run ruff check . with ruff 0.9.7 to review the reported violations. Inspect the listed tests/, install/hashview-agent/, migrations/env.py, and setup.py locations, distinguishing autofixable issues from intentional exceptions. Done means the full repository lint scope is clean and CI and the pre-push hook use the same command.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
ci-cd, tooling
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.