Skip to content

refactor(ado_proxy): reduce complexity of operations() in catalog.rs - #2102

Draft
github-actions[bot] wants to merge 1 commit into
mainfrom
refactor/reduce-complexity-catalog-operations-4-4be23be69a31f176
Draft

refactor(ado_proxy): reduce complexity of operations() in catalog.rs#2102
github-actions[bot] wants to merge 1 commit into
mainfrom
refactor/reduce-complexity-catalog-operations-4-4be23be69a31f176

Conversation

@github-actions

@github-actions github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

What was complex

operations() in src/ado_proxy/catalog.rs was a single 391-line function (flagged by clippy::too_many_lines at 391/100) building one large vec![...] literal containing every ADO proxy read-operation entry across all capability groups (Discovery, Core, Repos, Pipelines, Boards).

What changed

Split operations() into five smaller helper functions, one per Capability group:

  • discovery_operations()
  • core_operations()
  • repos_operations()
  • pipelines_operations()
  • boards_operations()

operations() itself now just concatenates the five vectors in the original order:

pub fn operations() -> Vec<Operation> {
    let mut ops = discovery_operations();
    ops.extend(core_operations());
    ops.extend(repos_operations());
    ops.extend(pipelines_operations());
    ops.extend(boards_operations());
    ops
}

No Operation entries were added, removed, or reordered — this is a pure structural split with a short doc comment on each new helper.

Before / after

  • Before: operations() — 391/100 lines (too_many_lines)
  • After: largest remaining function is repos_operations() at 148/100; operations() itself is well below threshold

Verification

  • cargo build — clean
  • cargo test --bin ado-aw — 3322 passed, 0 failed, 1 ignored
  • cargo clippy --all-targets --all-features — clean
  • Re-ran too_many_lines lint scoped to catalog.rs — no function above 148/100 remains

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • spsprodeus21.vssps.visualstudio.com

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

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

See Network Configuration for more information.

Generated by Cyclomatic Complexity Reducer · auto · 99.4 AIC · ⌖ 5.51 AIC · ⊞ 11.4K ·

… helpers

Splits the 391-line operations() function in src/ado_proxy/catalog.rs
into five smaller helper functions grouped by Capability:
discovery_operations, core_operations, repos_operations,
pipelines_operations, and boards_operations. operations() now simply
concatenates their results.

No behavior change: the returned Vec<Operation> is identical in
content and order. All 3322 tests pass; clippy is clean.

Before: too_many_lines fired at 391/100 for operations().
After: largest remaining helper (repos_operations) is 148/100.

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.

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