Skip to content

refactor: reduce complexity of apply_codemod in 0001_repos_unified - #2351

Draft
github-actions[bot] wants to merge 1 commit into
mainfrom
refactor/reduce-complexity-repos-unified-codemod-82967feb6fc78b28
Draft

github-actions[bot] wants to merge 1 commit into
mainfrom
refactor/reduce-complexity-repos-unified-codemod-82967feb6fc78b28

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

apply_codemod in src/compile/codemods/0001_repos_unified.rs was flagged by clippy::too_many_lines (131/100). Clippy's cognitive-complexity lint reported nothing.

Changes

  • Extracted parse_repositories, which validates the repositories: shape.
  • Extracted parse_checkout_aliases, which validates the checkout: entries.
  • Extracted convert_repository, which converts one legacy entry to a repos: entry. It also works out the checkout flag, and the nested if/else chain is now a single filter.

Behaviour and error messages are unchanged.

Verification

  • cargo test --bin ado-aw codemods: 85 passed.
  • cargo clippy --all-targets --all-features -- -W clippy::too_many_lines: apply_codemod is no longer flagged.

Generated by Cyclomatic Complexity Reducer · auto · 30.1 AIC · ⊞ 11.2K · ◷

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
2 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

This branch has not been deployed

No deployments
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.

0 participants