Skip to content

refactor: reduce complexity of execute_impl in src/safe_outputs/create_wiki_page.rs - #2412

Draft
github-actions[bot] wants to merge 1 commit into
mainfrom
refactor/reduce-complexity-create-wiki-page-c5c481276890986c
Draft

github-actions[bot] wants to merge 1 commit into
mainfrom
refactor/reduce-complexity-create-wiki-page-c5c481276890986c

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

CreateWikiPageResult::execute_impl was flagged by clippy::too_many_lines (158/100). Clippy's cognitive_complexity lint flagged nothing, so I used line count as the metric.

Extracted helpers, with no behaviour change:

  • resolve_effective_path: normalises the path and applies the traversal, path-prefix and title-prefix rules.
  • push_version_descriptor: de-duplicates the branch query params used by the GET and PUT requests.
  • check_page_absent: the GET existence check.
  • put_new_page: the create-only PUT with If-Match: "", plus the 412 and error mapping.
  • created_page_result: builds the success result.

Result: execute_impl is no longer flagged by too_many_lines.

Validation: cargo test passes in full (35 create_wiki_page tests). cargo clippy --all-targets --all-features shows no warnings for this file.

Warning

Firewall blocked 2 domains

The following domains were blocked by the firewall during workflow execution:

  • releaseassets.githubusercontent.com
  • spsprodeus21.vssps.visualstudio.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "releaseassets.githubusercontent.com"
    - "spsprodeus21.vssps.visualstudio.com"

See Network Configuration for more information.

Generated by Cyclomatic Complexity Reducer · auto · 58.7 AIC · ⊞ 6.7K · ◷

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