refactor(config): migrate commands to NewCommandSetup and remove lega…#640
Open
frjcomp wants to merge 1 commit into
Open
refactor(config): migrate commands to NewCommandSetup and remove lega…#640frjcomp wants to merge 1 commit into
frjcomp wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR completes a config-binding refactor by migrating command implementations and tests to the config.NewCommandSetup pattern and removing legacy flag-binding helpers from pkg/config, reducing duplicated boilerplate across CLI commands.
Changes:
- Removed legacy config binder functions (
BindCommandFlags,AutoBindFlags) frompkg/configand routed binding throughCommandSetup. - Migrated multiple platform commands (GitLab/GitHub/Gitea/Jenkins/Bitbucket/Azure DevOps) to
NewCommandSetup(...).WithFlagBindings(...).RequireKeys(...).MustBind(). - Updated unit/e2e tests and contributor instructions to match the new binding/validation approach.
Reviewed changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/e2e/gitea/vuln/vuln_test.go | Updates test commentary to reflect command setup based validation. |
| pkg/config/loader.go | Removes deprecated/legacy binder APIs from the config loader package. |
| pkg/config/loader_priority_test.go | Updates priority tests to bind flags via NewCommandSetup().WithFlagBindings(...).Bind(). |
| pkg/config/loader_priority_chain_test.go | Migrates chained precedence tests to NewCommandSetup binding. |
| pkg/config/loader_integration_test.go | Updates integration tests to use NewCommandSetup flag binding. |
| pkg/config/loader_inheritance_test.go | Updates inheritance tests to use NewCommandSetup binding. |
| pkg/config/loader_bind_test.go | Renames and rewrites binder tests to validate CommandSetup behavior. |
| pkg/config/config_coverage_test.go | Updates binding coverage tests and documentation text to reference NewCommandSetup. |
| pkg/config/command_setup.go | Moves flag-binding implementation behind CommandSetup (internal bindFlags). |
| internal/cmd/jenkins/scan/scan.go | Migrates Jenkins scan command to NewCommandSetup + explicit flagBindings. |
| internal/cmd/gitlab/tf/tf_test.go | Updates GitLab TF command tests to use NewCommandSetup binding. |
| internal/cmd/gitlab/scanpublic/scan_public.go | Migrates GitLab public scan command to NewCommandSetup + explicit flagBindings. |
| internal/cmd/gitlab/scan/scan.go | Migrates GitLab scan command to NewCommandSetup + required key validation. |
| internal/cmd/gitlab/scan/scan_test.go | Updates GitLab scan tests to bind via NewCommandSetup. |
| internal/cmd/gitlab/renovate/privesc/privesc.go | Migrates Renovate privesc command to NewCommandSetup + required key validation. |
| internal/cmd/gitlab/renovate/enum/enum.go | Migrates Renovate enum command to NewCommandSetup and removes legacy logging/binding flow. |
| internal/cmd/gitlab/renovate/bots/bots.go | Migrates Renovate bots command to NewCommandSetup + required key validation. |
| internal/cmd/gitlab/renovate/autodiscovery/autodiscovery.go | Migrates Renovate autodiscovery command to NewCommandSetup + required key validation. |
| internal/cmd/gitlab/container/artipacked/artipacked.go | Migrates artipacked audit command to NewCommandSetup + required key validation. |
| internal/cmd/github/scan/scan.go | Migrates GitHub scan command to NewCommandSetup + required key validation. |
| internal/cmd/github/scan/scan_flag_test.go | Updates GitHub scan tests to bind via NewCommandSetup. |
| internal/cmd/gitea/scan/scan.go | Migrates Gitea scan command to NewCommandSetup + required key validation. |
| internal/cmd/gitea/scan/scan_test.go | Updates Gitea scan tests to bind via NewCommandSetup. |
| internal/cmd/devops/scan/scan.go | Migrates Azure DevOps scan command to NewCommandSetup + required key validation. |
| internal/cmd/devops/scan/scan_test.go | Updates Azure DevOps scan tests to bind via NewCommandSetup. |
| internal/cmd/circle/scan/scan_test.go | Updates CircleCI scan tests to bind via NewCommandSetup. |
| internal/cmd/bitbucket/scan/scan.go | Migrates Bitbucket scan command to NewCommandSetup (binding consolidation via flagBindings). |
| .github/copilot-instructions.md | Updates contributor guidance to reflect removal of legacy binder APIs and NewCommandSetup usage. |
Comment on lines
117
to
119
| // MustBind is like Bind but logs fatal on error. Use this for commands where failure | ||
| // should immediately exit the program. | ||
| func (cs *CommandSetup) MustBind() { |
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.
…cy bind APIs