refactor: reduce cognitive complexity of dispatch and compile_pipeline_inner#831
Draft
github-actions[bot] wants to merge 1 commit into
Draft
Conversation
…e_inner Extract helper functions to bring both functions below Clippy's cognitive_complexity threshold (25): audit/cli.rs dispatch (51 → below 25): - fetch_and_record_artifacts: artifact listing/download loop with auth-error tracking - run_analyzers: all analyzer passes over downloaded artifacts - run_agent_output_analyzers: analyzers scoped to agent_outputs dir - populate_performance_metrics: backfill perf fields from analysis results compile/mod.rs compile_pipeline_inner (26 → below 25): - resolve_output_path: output path resolution (dir vs file vs default) - print_compile_success: success log line with pipeline/template label Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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
Two functions exceeded Clippy's
cognitive_complexitythreshold (25) and are refactored here by extracting well-named helper functions. No behaviour is changed.src/audit/cli.rs—dispatch(51 → below 25)The
dispatchfunction was doing five distinct jobs in one 275-line body. Four helpers are extracted:fetch_and_record_artifactsrun_analyzersrun_agent_output_analyzersagent_outputsartifact directory — firewall, policy, MCP, OTel passespopulate_performance_metricsAfter the refactor
dispatchis a clean ~65-line orchestration function.src/compile/mod.rs—compile_pipeline_inner(26 → below 25)Two small extractions:
resolve_output_pathNone→<stem>.lock.ymlprint_compile_successVerification
cargo test)clippy::cognitive_complexitywarnings remain (cargo clippy --all-targets --all-features -W clippy::cognitive_complexity)Warning
Firewall blocked 2 domains
The following domains were blocked by the firewall during workflow execution:
spsprodeus21.vssps.visualstudio.comspsprodweu4.vssps.visualstudio.comSee Network Configuration for more information.