ReadonlycategoryCategory indicating this is a code restructuring transformation.
ReadonlydescriptionDetailed description of the transformation's purpose and behavior.
ReadonlyidUnique identifier following plugin-name:rule-name convention.
ReadonlynameHuman-readable name for the transformation.
ReadonlytagsTags for discoverability and filtering.
Transforms God Switch violations into Factory Pattern implementations.
Process:
Idempotency: Running multiple times on the same file is safe - the orchestrator checks for existing factory implementations and skips already-transformed switches.
Atomicity: The orchestrator uses backup/rollback mechanisms to ensure all-or-nothing semantics. If any step fails, the source file is restored to its original state.
Transform context containing source file, configuration, and API access
Promise resolving to transformation result with modification status and message
Transform rule that converts large switch statements into maintainable Factory Pattern implementations.
Problem: Large switch statements (10+ cases) violate SOLID principles:
Solution: Transforms God Switch into Factory Pattern using Strategy pattern:
Before:
After:
Configuration:
See
GodSwitchTransformOrchestrator for detailed transformation logic
Example