Skip to content

Code cleanup: coverage improvements and dead code removal#53

Merged
ericodx merged 29 commits intomainfrom
code-clean-up
Apr 5, 2026
Merged

Code cleanup: coverage improvements and dead code removal#53
ericodx merged 29 commits intomainfrom
code-clean-up

Conversation

@ericodx
Copy link
Copy Markdown
Owner

@ericodx ericodx commented Apr 5, 2026

Summary

  • Add LocalizedError conformance to BuildError and SimulatorError for proper error messages through generic catch blocks
  • Collapse specific catch blocks into generic catch in SwiftMutationTesting.run, extract defaultLauncher helper
  • Remove unreachable defensive code in IncompatibleMutantExecutor, ProjectDetector, MutationRewriter, SchemataGenerator, and DiscoveryPipeline
  • Replace try! with guard let try? in MutantExecutor.rewriteForIncompatible
  • Make killEscapedChildren internal for testability
  • Extract ProcessRequest and ProcessRunner to reduce duplication across launchers
  • Add ProjectDetector SPM test targets and testing framework detection
  • Exclude Tests directory from SwiftLint and Periphery validation

Type of Change

  • feat: A new feature has been added.
  • refactor: A code change that neither fixes a bug nor adds a feature.
  • test: Addition or correction of tests.
  • chore: Other changes that do not fit into the previous categories.

Invariants Checklist

  • Original project is never modified — all mutations happen inside an isolated sandbox
  • xcodebuild build-for-testing runs exactly once for all schematizable mutants
  • No mutant results are lost or duplicated
  • Mutant positions (file, line, column) are accurate in all reported results
  • A cancelled task never leaves a simulator slot permanently acquired from the pool
  • schematizedContent never contains the __swiftMutationTestingID global declaration
  • Swift 6 Strict Concurrency compatible
  • Pipeline stages remain stateless pure transformations

Pipeline Impact

Which stages are affected?

  • SandboxFactory
  • BuildStage
  • SimulatorPool
  • TestExecutionStage
  • IncompatibleMutantExecutor
  • PerFileBuildFallback
  • CacheStore
  • Reporters (Text / JSON / HTML / Sonar)
  • CLI / Configuration
  • Models / RunnerInput contract
  • None

Testing

  • Unit tests added or updated
  • Tests use mock ProcessLaunching — no real xcodebuild, xcrun simctl, or xcresulttool
  • Tests use FileHelpers for any filesystem interaction (temp directories only)
  • Snapshot tests added or updated (if reporter output format changed)
  • Integration tests added or updated and tagged separately (if pipeline or CLI behavior changed)
  • All tests pass locally (swift test)

Coverage

Line coverage improved from 99.10% (42 missed) to 99.53% (22 missed). Key additions:

  • BuildErrorTests — errorDescription and equality
  • SimulatorErrorTests — errorDescription for all cases
  • MutantExecutorCoverageTests — catch block, errorLines fallback, removingCases default transition
  • FallbackExecutorTests — SPM build success path
  • KillEscapedChildrenTests — process matching with real process spawning
  • defaultLauncher tests for xcode and spm project types

ericodx added 29 commits April 5, 2026 00:48
@ericodx ericodx self-assigned this Apr 5, 2026
@ericodx ericodx changed the title Code clean up Code cleanup: coverage improvements and dead code removal Apr 5, 2026
@ericodx ericodx added refactor Code change that neither fixes a bug nor adds a feature test Addition or correction of tests chore Maintenance tasks and housekeeping labels Apr 5, 2026
@ericodx ericodx merged commit 58c5973 into main Apr 5, 2026
1 check passed
@ericodx ericodx deleted the code-clean-up branch April 5, 2026 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Maintenance tasks and housekeeping refactor Code change that neither fixes a bug nor adds a feature test Addition or correction of tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant