refactor: split scan_repo, _folder and _entry below CC 15 (#51) - #64
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 listnow 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_excludesand_log_taken.repos._entry, CC 17 → 13. Pulled out_remote_only(the entry has nopath:) and_no_checkout(thepath:has no checkout).uvx radon cc collector/jq_collector -s -ncafterwards: 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 checkandruff format --check: passmypy(strict): no issues in 11 filespytest --cov=jq_collector: 456 passed, 100% of lines and branches (402 branches, the same count as before)pyteston Python 3.11: 456 passedprek run --all-files: everything passes except bandit and shellcheck. Those two are already red onmainand are fixed by fix: run the pre-commit hooks in CI and clear bandit and shellcheck (#59) #63, not by this PR.Not addressed
localgit.py, as fix: run the pre-commit hooks in CI and clear bandit and shellcheck (#59) #63 does. They edit different hunks (_gitand the import vs.scan_repo), so they should merge cleanly in either order.Closes #51
🤖 Generated with Claude Code