Skip to content

refactor: reduce complexity of execute_impl in create_git_tag.rs - #2376

Draft
github-actions[bot] wants to merge 1 commit into
mainfrom
refactor/reduce-complexity-create-git-tag-51f7e28b50874f56
Draft

github-actions[bot] wants to merge 1 commit into
mainfrom
refactor/reduce-complexity-create-git-tag-51f7e28b50874f56

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

No function tripped cognitive_complexity, so I used clippy::too_many_lines instead. CreateGitTagResult::execute_impl was flagged at 122 lines against the limit of 100.

I split three blocks out of it into private helpers:

  • check_policy covers the tag-pattern and allowed-repositories checks.
  • build_tag_message builds the message with the optional prefix.
  • handle_response handles the success and failure HTTP responses.

Behaviour is unchanged. After the refactor, execute_impl no longer shows up under too_many_lines. The 14 create_git_tag tests pass. I ran only that test filter, not the full cargo test. I also re-ran clippy with too_many_lines and nothing is flagged for create_git_tag.rs.

Generated by Cyclomatic Complexity Reducer · auto · 25.8 AIC · ⊞ 11.1K · ◷

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

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
1 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