feat: add expression removal mutation operator - #86
Merged
Merged
Conversation
Add ExpressionRemovalMutator that removes expression statements (e.g. function calls evaluated for their side effects) by replacing them with an empty statement, testing whether those side effects are properly covered by tests. The no-mutations engine test sample was updated to an empty function body since an expression statement is now a valid mutation target. Closes #20
sivchari
force-pushed
the
worktree-feat+expression-removal-20
branch
from
June 14, 2026 13:45
adf626f to
3008118
Compare
Contributor
🧬 Mutation Testing Results✅ Quality Gate: PASSED Overall Mutation Score: 58.1% 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
ExpressionRemovalMutatorthat removes expression statements (replaces them with an empty statement)*ast.ExprStmt(function calls evaluated for side effects, channel receives used for sync, etc.)CursorApplierinterface for node replacementDisambiguation from related issues
One of three statement-removal operators, partitioned by node type to avoid duplicate mutants:
*ast.AssignStmt*ast.ExprStmtNote
TestGenerateMutants_NoMutationspreviously relied onfmt.Println("hello")(an expression statement); the sample is now an empty function body.Changes
internal/mutation/expressionremoval.go— new mutatorinternal/mutation/expressionremoval_test.go— unit tests (incl.ApplyWithCursor)internal/mutation/registry.go— regenerated (8 mutators)internal/mutation/engine_test.go— updated mutator count/list and no-mutations sampleinternal/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 aping()callmake lint(pinned golangci-lint) reports 0 issuesCloses #20