refactor(compile): reduce complexity of validate_github_issue_outputs_config in common.rs - #2229
Closed
github-actions[bot] wants to merge 1 commit into
Conversation
…_config Split the 25/15 cognitive-complexity function into five focused helpers: - validate_temporary_id_consumers_approval_lane - validate_github_issue_tool_config - dispatch_github_issue_tool_config_validation - validate_create_github_issue_injection - validate_set_github_issue_type_injection No behavior change; validate_github_issue_outputs_config now orchestrates these helpers and is no longer flagged by clippy::cognitive_complexity. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
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. |
Collaborator
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
Clippy's
cognitive_complexitylint (threshold 15) flaggedvalidate_github_issue_outputs_configinsrc/compile/common.rsat 25/15 — the highest-complexity non-test function currently in the codebase.The function mixed four distinct concerns in one body:
require-approvallane consistency for temporary-issue-ID consumers.matchdispatching to each tool's dedicated config validator.create-github-issueandset-github-issue-typefree-text fields.Changes
Extracted five well-named helpers, each owning one concern:
validate_temporary_id_consumers_approval_lane— thecreate-github-issue/ consumer approval-lane check.validate_github_issue_tool_config— shared repo-policy + mutation-filter validation per tool.dispatch_github_issue_tool_config_validation— the tool-namematchdispatch (unchanged arms, just isolated).validate_create_github_issue_injection— injection checks forcreate-github-issue's title prefix, labels, allowed-labels, assignees.validate_set_github_issue_type_injection— injection checks forset-github-issue-type.allowed.validate_github_issue_outputs_confignow simply orchestrates these helpers in the same original order, preserving all early-return/?-propagation semantics.Verification
cargo build— clean.cargo test— full suite passes (all binaries/integration tests), no regressions.cargo clippy --all-targets --all-features— clean, no new warnings.clippy::cognitive_complexitywith threshold 15:validate_github_issue_outputs_configis no longer flagged (down from 25/15).No public API, behavior, or error-message changes.
Warning
Firewall blocked 2 domains
The following domains were blocked by the firewall during workflow execution:
releaseassets.githubusercontent.comspsprodeus21.vssps.visualstudio.comTo allow these domains, add them to the
network.allowedlist in your workflow frontmatter:See Network Configuration for more information.