Skip to content

refactor(cli[add]) Extract duplicated save-config dispatch helpers#530

Open
tony wants to merge 1 commit intomasterfrom
refactor/add-repo-dedup
Open

refactor(cli[add]) Extract duplicated save-config dispatch helpers#530
tony wants to merge 1 commit intomasterfrom
refactor/add-repo-dedup

Conversation

@tony
Copy link
Member

@tony tony commented Mar 1, 2026

Summary

Closes #521

  • Extract _save_config_or_log_error() for the try/except/log.exception pattern (used 4x)
  • Extract _extract_current_url() for deriving display URLs from config entries (duplicated in merge/no-merge paths)
  • Extract _handle_skip_action() for SKIP_PINNED/SKIP_EXISTING branches (~30 lines each, duplicated)
  • Both merge and no-merge paths now use local closures + shared helpers

Test plan

  • uv run ruff check . — all checks passed
  • uv run ruff format . — no changes needed
  • uv run mypy — no issues found
  • uv run py.test -vvv — 1175 passed

Closes #521

why: merge/no-merge paths in add_repo() duplicate ~200 lines of logic.
what:
- Extract _save_config_or_log_error() for try/except/log pattern
- Extract _extract_current_url() for URL derivation from config entries
- Extract _handle_skip_action() for SKIP_PINNED/SKIP_EXISTING branches
- Both code paths now share the same dispatch helpers
@codecov
Copy link

codecov bot commented Mar 1, 2026

Codecov Report

❌ Patch coverage is 50.00000% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.04%. Comparing base (bdfaa95) to head (0674d9d).

Files with missing lines Patch % Lines
src/vcspull/cli/add.py 50.00% 14 Missing and 5 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #530      +/-   ##
==========================================
+ Coverage   83.51%   84.04%   +0.53%     
==========================================
  Files          29       29              
  Lines        3645     3635      -10     
  Branches      726      722       -4     
==========================================
+ Hits         3044     3055      +11     
+ Misses        386      364      -22     
- Partials      215      216       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tony
Copy link
Member Author

tony commented Mar 1, 2026

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

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.

refactor(cli[add]) Extract duplicated save-config dispatch helpers

1 participant