refactor(configure): reduce complexity of run in src/configure.rs#349
Merged
jamesadevine merged 1 commit intoApr 29, 2026
Merged
Conversation
Extract five focused helpers from the monolithic run() function: - resolve_token: CLI flag → interactive prompt - resolve_auth: PAT flag → Azure CLI → interactive prompt - resolve_ado_context: git remote → override with --org/--project flags - resolve_definitions: explicit IDs or auto-detect + match - apply_token_updates: update loop with per-definition reporting run() becomes a thin coordinator that delegates to each helper and handles the two early-exit paths (no pipelines found, dry-run). Cognitive complexity: 27 → below threshold (25) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
jamesadevine
approved these changes
Apr 29, 2026
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.
Summary
The
runfunction insrc/configure.rswas flagged by Clippy'scognitive_complexitylint at 27/25. It was a single ~230-line async function doing five distinct jobs inline.What changed
Five focused helper functions were extracted from
run:resolve_tokenresolve_authresolve_ado_context--org/--projectoverridesresolve_definitions--definition-idsor auto-detect + ADO matchapply_token_updatesrunis now a thin coordinator (~50 lines) that calls each helper in order and handles the two early-exit paths (no pipelines found, dry-run).Behaviour
No observable behaviour changes. All existing tests pass. Each helper is individually readable and testable.
Complexity
run