feat: add statement removal mutation operator - #87
Merged
Merged
Conversation
Add StatementRemovalMutator that removes increment/decrement, defer, go, and channel send statements by replacing them with an empty statement, testing whether their side effects are covered by tests. Assignment and expression statements are intentionally excluded; they are handled by the dedicated assignment_removal and expression_removal mutators to avoid generating duplicate mutants. Closes #6
sivchari
force-pushed
the
worktree-feat+statement-removal-6
branch
from
June 15, 2026 05:22
56c8dd1 to
acd24a7
Compare
Contributor
🧬 Mutation Testing Results✅ Quality Gate: PASSED Overall Mutation Score: 63.2% Files with Mutations
Generated by gomu mutation testing |
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
StatementRemovalMutatorthat removes statements carrying a side effect by replacing them with an empty statementi++,i--),defer,go, and channel send (ch <- v)CursorApplierinterface for node replacementDisambiguation from related issues
One of three statement-removal operators, partitioned by node type to avoid duplicate mutants:
*ast.AssignStmt*ast.ExprStmt*ast.IncDecStmt,*ast.DeferStmt,*ast.GoStmt,*ast.SendStmtAssignStmtandExprStmtare explicitly excluded here so the three operators never target the same node.Changes
internal/mutation/statementremoval.go— new mutatorinternal/mutation/statementremoval_test.go— unit tests (incl.ApplyWithCursor)internal/mutation/registry.go— regenerated (8 mutators)internal/mutation/engine_test.go— updated mutator count/listinternal/execution/overlay_test.go+ testdata — end-to-end golden testREADME.md— documented the new mutation typeTest plan
go build ./...,go vet ./...,go test ./...TestMutateAndApplyIntegrationcovers removing*counter++make lint(pinned golangci-lint) reports 0 issuesCloses #6