refactor(cli): extract per-repo check helper from cmd_check (S3776) #74

Open
Claude wants to merge 1 commit from Claude/backup-script:fix/issue-22-S3776-cmd-check-complexity into master
First-time contributor

Closes #22

cmd_check had cognitive complexity 24 (SonarQube ceiling: 15).

Refactor

Extracted _check_one_repo(restic, repo, dest, args, log) -> bool covering the
try/except around restic.check plus the result.ok branching and log
emission. The nested cmd_check loop body now reduces to a single line:
if not _check_one_repo(...): failed += 1. No behavior change — same logged
events (check.ok, check.failed, check.exception), same exit code, same
counters.

Behavior

Identical.

Verification

  • pytest -q tests/unit/ — passes
  • mypy --strict src/gardien/core src/gardien/config src/gardien/engine src/gardien/steps — passes
Closes #22 `cmd_check` had cognitive complexity 24 (SonarQube ceiling: 15). ### Refactor Extracted `_check_one_repo(restic, repo, dest, args, log) -> bool` covering the try/except around `restic.check` plus the `result.ok` branching and log emission. The nested `cmd_check` loop body now reduces to a single line: `if not _check_one_repo(...): failed += 1`. No behavior change — same logged events (`check.ok`, `check.failed`, `check.exception`), same exit code, same counters. ### Behavior Identical. ### Verification - `pytest -q tests/unit/` — passes - `mypy --strict src/gardien/core src/gardien/config src/gardien/engine src/gardien/steps` — passes
`cmd_check` had cognitive complexity 24 (SonarQube ceiling: 15).
Extract `_check_one_repo` so the nested loop body is one line.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u fix/issue-22-S3776-cmd-check-complexity:Claude-fix/issue-22-S3776-cmd-check-complexity
git switch Claude-fix/issue-22-S3776-cmd-check-complexity

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch master
git merge --no-ff Claude-fix/issue-22-S3776-cmd-check-complexity
git switch Claude-fix/issue-22-S3776-cmd-check-complexity
git rebase master
git switch master
git merge --ff-only Claude-fix/issue-22-S3776-cmd-check-complexity
git switch Claude-fix/issue-22-S3776-cmd-check-complexity
git rebase master
git switch master
git merge --no-ff Claude-fix/issue-22-S3776-cmd-check-complexity
git switch master
git merge --squash Claude-fix/issue-22-S3776-cmd-check-complexity
git switch master
git merge --ff-only Claude-fix/issue-22-S3776-cmd-check-complexity
git switch master
git merge Claude-fix/issue-22-S3776-cmd-check-complexity
git push origin master
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
bc1bb/backup-script!74
No description provided.