Scalafix Migration Rule for derevo v0.11.0
package fix | |
package v0_11_0 | |
import metaconfig.Configured | |
import scalafix.v1._ | |
import scala.meta._ | |
class RenamePackages extends SemanticRule("RenamePackages") { | |
override def fix(implicit doc: SemanticDocument): Patch = { | |
Patch.replaceSymbols( | |
// Cats | |
"org.manatki.derevo.catsInstances.eq" -> "derevo.cats.eq", | |
"org.manatki.derevo.catsInstances.monoid" -> "derevo.cats.monoid", | |
"org.manatki.derevo.catsInstances.order" -> "derevo.cats.order", | |
"org.manatki.derevo.catsInstances.semigroup" -> "derevo.cats.semigroup", | |
"org.manatki.derevo.catsInstances.show" -> "derevo.cats.show", | |
// Cats Tagless | |
"org.manatki.derevo.tagless.functorK" -> "derevo.tagless.functorK", | |
"org.manatki.derevo.tagless.invariantK" -> "derevo.tagless.invariantK", | |
"org.manatki.derevo.tagless.semigroupalK" -> "derevo.tagless.semigroupalK", | |
"org.manatki.derevo.tagless.applyK" -> "derevo.tagless.applyK", | |
"org.manatki.derevo.tagless.functor" -> "derevo.tagless.functor", | |
"org.manatki.derevo.tagless.invariant" -> "derevo.tagless.invariant", | |
"org.manatki.derevo.tagless.contravariant" -> "derevo.tagless.contravariant", | |
"org.manatki.derevo.tagless.flatMap" -> "derevo.tagless.flatMap", | |
// Circe | |
"org.manatki.derevo.circeDerivation.decoder" -> "derevo.circe.decoder", | |
"org.manatki.derevo.circeDerivation.encoder" -> "derevo.circe.encoder", | |
// Tethys | |
"org.manatki.derevo.tethysInstances.tethysReader" -> "derevo.tethys.tethysReader", | |
"org.manatki.derevo.tethysInstances.tethysWriter" -> "derevo.tethys.tethysWriter", | |
// Ciris | |
"org.manatki.derevo.cirisDerivation.cirisDecoder" -> "derevo.ciris.cirisDecoder", | |
// PureConfig | |
"org.manatki.derevo.pureconfigDerivation.pureconfigReader" -> "derevo.pureconfig.pureconfigReader", | |
"org.manatki.derevo.pureconfigDerivation.pureconfigWriter" -> "derevo.pureconfig.pureconfigWriter", | |
// ScalaCheck | |
"org.manatki.derevo.scalacheckDerivation.arbitrary" -> "derevo.scalacheck.arbitrary", | |
// TypedSchema | |
"org.manatki.derevo.tschemaInstances.swagger" -> "derevo.tschema.swagger", | |
"org.manatki.derevo.tschemaInstances.openapiParam" -> "derevo.tschema.openapiParam", | |
"org.manatki.derevo.tschemaInstances.httpParam" -> "derevo.tschema.httpParam", | |
// ReactiveMongo | |
"org.manatki.derevo.reactivemongoDerivation.bsonDocumentWriter" -> "derevo.reactivemongo.bsonDocumentWriter", | |
"org.manatki.derevo.reactivemongoDerivation.bsonDocumentReader" -> "derevo.reactivemongo.bsonDocumentReader", | |
"org.manatki.derevo.reactivemongoDerivation.BsonValueReader" -> "derevo.reactivemongo.BsonValueReader", | |
"org.manatki.derevo.reactivemongoDerivation.BsonValueWriter" -> "derevo.reactivemongo.BsonValueWriter", | |
// Core | |
"org.manatki.derevo.InstanceDef" -> "derevo.InstanceDef", | |
"org.manatki.derevo.Derivation" -> "derevo.Derivation", | |
"org.manatki.derevo.DerivationK1" -> "derevo.DerivationK1", | |
"org.manatki.derevo.DerivationK2" -> "derevo.DerivationK2", | |
"org.manatki.derevo.PolyDerivation" -> "derevo.PolyDerivation" | |
) | |
} | |
} | |
class RenameAnnotations extends SemanticRule("RenameAnnotations") { | |
override def fix(implicit doc: SemanticDocument): Patch = { | |
doc | |
.tree | |
.collect { | |
case t @ q"import org.manatki.derevo.derive" => | |
Patch.replaceTree(t, "import derevo.derive") | |
case t @ q"import org.manatki.derevo.delegating" => | |
Patch.replaceTree(t, "import derevo.delegating") | |
case t @ q"import org.manatki.derevo.phantom" => | |
Patch.replaceTree(t, "import derevo.phantom") | |
} | |
.asPatch | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment