[fp-enhancer] Improve pkg/cli with functional transformations#12996
Closed
github-actions[bot] wants to merge 2 commits intomainfrom
Closed
[fp-enhancer] Improve pkg/cli with functional transformations#12996github-actions[bot] wants to merge 2 commits intomainfrom
github-actions[bot] wants to merge 2 commits intomainfrom
Conversation
Apply tasteful functional programming improvements to pkg/cli: - Replace imperative loops with declarative sliceutil.Map - Eliminate index variables in simple transformations - Improve code clarity and consistency Changes: - add_workflow_pr.go: Extract workflow names functionally - audit_report_analysis.go: Extract server names functionally - add_command.go: Extract workflow specs functionally - add_workflow_repository.go: Convert to list items functionally All tests pass (go test ./pkg/cli/)
dsyme
approved these changes
Feb 1, 2026
This was referenced Feb 1, 2026
Contributor
|
@copilot merge main recompile |
Contributor
This was referenced Feb 1, 2026
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.
Functional/Immutability Enhancements - Package:
pkg/cliThis PR applies moderate, tasteful functional/immutability techniques to the
pkg/clipackage to improve code clarity, safety, testability, and maintainability.Round-Robin Progress: This is part of a systematic package-by-package refactoring. Next package to process:
pkg/cli/fileutilSummary of Changes
Functional Transformations Applied
Converted 4 imperative loop patterns to declarative functional transformations using the existing
sliceutil.Maputility:Files affected:
pkg/cli/add_workflow_pr.go- Workflow name extractionpkg/cli/audit_report_analysis.go- Server name extractionpkg/cli/add_command.go- Workflow spec extractionpkg/cli/add_workflow_repository.go- List item conversionBenefits
sliceutil.Mappattern established in the codebasePrinciples Applied
sliceutil.Mapalready in the codebaseTesting
go test ./pkg/cli/)make build)Review Focus
Please verify:
Examples
Before: Imperative loop
After: Functional transformation
Benefits
isliceutil.MaputilityPattern Consistency
This change improves consistency with the functional patterns already established in the codebase:
pkg/sliceutil/sliceutil.goprovidesMap,Filter,Reduce,FilterMappkg/clibrings consistency with existing patternsImpact Assessment
pkg/clipackageWorkflow Run: §21548947321