Skip to content

refactor: split scan_repo, _folder and _entry below CC 15 (#51) - #64

Merged
tschm merged 2 commits into
mainfrom
rhiza_fix_51_20261001
Oct 1, 2026
Merged

tschm merged 2 commits into
mainfrom
rhiza_fix_51_20261001

Conversation

@tschm

@tschm tschm commented Oct 1, 2026

Copy link
Copy Markdown
Member

Fixes #51.

Acceptance criterion (verbatim): "radon reports no block above CC 14 in jq_collector, and coverage stays at 100%."

What changed

This is a pure extraction: no behaviour change, and every error and log message is byte-identical.

  • localgit.scan_repo, CC 18 → below C. The status counts, HEAD time and sha, branch naming (including detached HEAD) and stash count each moved into their own helper: _status_counts, _head, _branch_name, _stash_count. One side effect: git stash list now runs a few calls later within a single scan. It's read-only and independent of the other calls.
  • repos._folder, CC 17 → below C. Pulled out _refuse_single_repo_keys, _checkouts_in (the unreadable and empty folder refusals), _warn_spent_excludes and _log_taken.
  • repos._entry, CC 17 → 13. Pulled out _remote_only (the entry has no path:) and _no_checkout (the path: has no checkout).

uvx radon cc collector/jq_collector -s -nc afterwards: the highest is 14 (repos.load, localgit.scan, github.collect, GitHub.active_workflows), and nothing is above 14.

Gates (run locally on this branch)

  • ruff check and ruff format --check: pass
  • mypy (strict): no issues in 11 files
  • pytest --cov=jq_collector: 456 passed, 100% of lines and branches (402 branches, the same count as before)
  • pytest on Python 3.11: 456 passed
  • prek run --all-files: everything passes except bandit and shellcheck. Those two are already red on main and are fixed by fix: run the pre-commit hooks in CI and clear bandit and shellcheck (#59) #63, not by this PR.

Not addressed

Closes #51

🤖 Generated with Claude Code

@tschm
tschm merged commit 5a9a5d8 into main Oct 1, 2026
6 checks passed
@tschm
tschm deleted the rhiza_fix_51_20261001 branch October 1, 2026 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Split scan_repo, _folder and _entry (CC 17–18) below CC 15

1 participant