Add codemod exclusion flags to fix and upgrade#38688
Merged
Merged
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
Add disable-codemod flags to fix and upgrade
Add codemod exclusion flags to Jun 11, 2026
fix and upgrade
Copilot created this pull request from a session on behalf of
pelikhan
June 11, 2026 17:51
View session
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a user-facing mechanism to exclude specific codemods by ID when running gh aw fix and the internal fix step within gh aw upgrade, including validation that unknown codemod IDs produce an error.
Changes:
- Add repeatable
--disable-codemodflag to bothfixandupgradecommands and thread disabled IDs through config/options. - Introduce
GetCodemods(disabledIDs)to filter the codemod registry and reject unknown IDs. - Add unit tests covering flag registration, filtering behavior, unknown-ID errors, and an end-to-end skip case.
Show a summary per file
| File | Description |
|---|---|
| pkg/cli/upgrade_command.go | Adds --disable-codemod to upgrade and passes disabled codemod IDs into the fix step config. |
| pkg/cli/upgrade_command_test.go | Asserts the new --disable-codemod flag is registered and described in help text. |
| pkg/cli/fix_command.go | Adds --disable-codemod to fix and switches codemod loading from GetAllCodemods() to filtered GetCodemods(...). |
| pkg/cli/fix_command_test.go | Adds tests for flag registration and an end-to-end “disabled codemod is skipped” scenario. |
| pkg/cli/fix_codemods.go | Implements GetCodemods(...) filtering + unknown-ID validation. |
| pkg/cli/fix_codemods_test.go | Adds tests for disable filtering and unknown-ID error behavior. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 6/6 changed files
- Comments generated: 1
This was referenced Jun 11, 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.
This adds a way to opt specific codemods out of
gh aw fixandgh aw upgrade. The change is scoped to codemod selection: callers can now suppress individual migrations by codemod ID, and invalid IDs fail fast.CLI surface
--disable-codemodtogh aw fix--disable-codemodtogh aw upgradeCodemod selection
Command wiring
FixConfigand the upgrade flowupgradepasses exclusions into its internalfixstepCoverage
Example: