From 12e33a01ca1bb6cd63f83d66f788b96b5f2547eb Mon Sep 17 00:00:00 2001 From: xuwei-k <6b656e6a69@gmail.com> Date: Fri, 23 Feb 2024 15:19:43 +0900 Subject: [PATCH] prepare Scala 2.13.13. sort imports --- .github/workflows/ci.yml | 2 +- .scalafix.conf | 6 ++++++ build.sbt | 1 + .../scala/fix/AddExplicitImplicitTypes.scala | 8 +++++++- .../scala/fix/AddLambdaParamParentheses.scala | 7 +++++-- rules/src/main/scala/fix/CirceCodec.scala | 14 ++++++++------ rules/src/main/scala/fix/CollectHead.scala | 4 +++- .../main/scala/fix/CollectHeadOption.scala | 4 +++- .../src/main/scala/fix/CompareSameValue.scala | 4 ++++ .../scala/fix/DirectoryAndPackageName.scala | 15 ++++++++------- .../main/scala/fix/DiscardSingleConfig.scala | 2 +- rules/src/main/scala/fix/DiscardValue.scala | 3 +++ .../scala/fix/DuplicateWildcardImport.scala | 4 ++++ rules/src/main/scala/fix/EitherFold.scala | 9 ++++++--- .../src/main/scala/fix/EitherGetOrElse.scala | 8 +++++--- rules/src/main/scala/fix/EitherMap.scala | 8 +++++--- rules/src/main/scala/fix/EtaExpand.scala | 7 +++++-- .../scala/fix/ExplicitImplicitTypes.scala | 19 +++++++++++-------- .../fix/ExtendsProductWithSerializable.scala | 4 ++++ .../main/scala/fix/FileNameConsistent.scala | 12 +++++++----- rules/src/main/scala/fix/FilterNot.scala | 2 ++ rules/src/main/scala/fix/FilterSize.scala | 4 +++- .../src/main/scala/fix/FinalObjectWarn.scala | 8 ++++++-- rules/src/main/scala/fix/FlatMapCollect.scala | 4 ++++ rules/src/main/scala/fix/FlatTraverse.scala | 4 +++- rules/src/main/scala/fix/GroupMap.scala | 2 ++ .../main/scala/fix/ImplicitValueClass.scala | 11 +++++++---- .../scala/fix/IncorrectScaladocParam.scala | 10 ++++++---- .../scala/fix/InterpolationToString.scala | 2 ++ .../scala/fix/InterpolationToStringWarn.scala | 4 +++- .../src/main/scala/fix/IsEmptyNonEmpty.scala | 6 ++++-- .../scala/fix/JavaURLConstructorsWarn.scala | 2 ++ rules/src/main/scala/fix/KeySet.scala | 5 ++++- rules/src/main/scala/fix/KindProjector.scala | 4 +++- .../scala/fix/LambdaParamParentheses.scala | 9 ++++++--- rules/src/main/scala/fix/LazyZip.scala | 4 ++++ .../src/main/scala/fix/MapDistinctSize.scala | 4 +++- .../main/scala/fix/MapFlattenFlatMap.scala | 4 ++++ .../main/scala/fix/MapSequenceTraverse.scala | 8 +++++--- rules/src/main/scala/fix/MapToForeach.scala | 2 ++ .../src/main/scala/fix/NamedParamOrder.scala | 5 ++++- rules/src/main/scala/fix/NoElse.scala | 8 +++++--- rules/src/main/scala/fix/ObjectFinal.scala | 4 ++++ rules/src/main/scala/fix/ObjectSelfType.scala | 4 +++- rules/src/main/scala/fix/OptionContains.scala | 9 ++++++--- rules/src/main/scala/fix/OptionFilter.scala | 8 +++++--- .../main/scala/fix/OptionForallExists.scala | 9 ++++++--- .../src/main/scala/fix/OptionGetOrElse.scala | 9 ++++++--- rules/src/main/scala/fix/OptionGetWarn.scala | 3 +++ .../src/main/scala/fix/OptionMapFlatMap.scala | 8 +++++--- .../main/scala/fix/OptionMatchToRight.scala | 8 +++++--- rules/src/main/scala/fix/OptionOrElse.scala | 9 ++++++--- .../src/main/scala/fix/OptionWhenUnless.scala | 2 ++ .../scala/fix/PartialFunctionCondOpt.scala | 10 +++++++--- .../scala/fix/RedundantCaseClassVal.scala | 10 +++++++--- .../main/scala/fix/RemoveEmptyObject.scala | 6 ++++-- rules/src/main/scala/fix/RemoveIf.scala | 2 ++ rules/src/main/scala/fix/RemovePureEff.scala | 10 ++++++---- .../scala/fix/RemoveSamePackageImport.scala | 7 +++++-- .../scala/fix/RemoveStringInterpolation.scala | 5 ++++- .../fix/RemoveUselessParamComments.scala | 8 +++++--- .../src/main/scala/fix/RepeatedRewrite.scala | 6 +++++- rules/src/main/scala/fix/ReplaceFill.scala | 9 ++++++--- .../main/scala/fix/ReplacePlaceholder.scala | 7 +++++-- .../scala/fix/ReplaceSymbolLiterals.scala | 3 ++- rules/src/main/scala/fix/ReuseInstances.scala | 3 +++ .../main/scala/fix/SameParamOverloading.scala | 4 ++++ .../main/scala/fix/Scala3ImportRewrite.scala | 4 +++- .../src/main/scala/fix/Scala3ImportWarn.scala | 8 +++++--- .../main/scala/fix/Scala3Placeholder.scala | 8 +++++--- rules/src/main/scala/fix/ScalaApp.scala | 11 +++++++---- .../main/scala/fix/ScalazEitherInfix.scala | 7 +++++-- .../src/main/scala/fix/SimplifyForYield.scala | 9 ++++++--- rules/src/main/scala/fix/SizeToLength.scala | 5 ++++- rules/src/main/scala/fix/SlickFilter.scala | 6 ++++-- .../fix/StringFormatToInterpolation.scala | 8 ++++++-- .../scala/fix/SyntacticOrganizeImports.scala | 15 ++++++++++----- .../main/scala/fix/ThrowableToNonFatal.scala | 9 +++++++-- .../src/main/scala/fix/UnnecessaryCase.scala | 9 ++++++--- .../src/main/scala/fix/UnnecessaryMatch.scala | 8 +++++--- .../src/main/scala/fix/UnnecessarySort.scala | 6 ++++-- .../scala/fix/UnnecessarySortRewrite.scala | 8 +++++--- .../scala/fix/UnusedConstructorParams.scala | 10 +++++++--- .../src/main/scala/fix/UnusedTypeParams.scala | 4 ++++ .../scala/fix/UselessParamCommentsWarn.scala | 11 +++++++---- rules/src/main/scala/fix/WithFilter.scala | 4 +++- .../fix/IncorrectScaladocParamTest.scala | 2 +- 87 files changed, 401 insertions(+), 167 deletions(-) create mode 100644 .scalafix.conf diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7385656..752710b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,4 +28,4 @@ jobs: - uses: coursier/cache-action@v6 - run: sbt test - if: matrix.os != 'windows-latest' - run: sbt scalafmtSbtCheck scalafmtCheckAll + run: sbt scalafmtSbtCheck scalafmtCheckAll "rules2_13/scalafixAll --check OrganizeImports" diff --git a/.scalafix.conf b/.scalafix.conf new file mode 100644 index 0000000..44a096e --- /dev/null +++ b/.scalafix.conf @@ -0,0 +1,6 @@ +OrganizeImports { + expandRelative = true + groupExplicitlyImportedImplicitsSeparately = false + groups = ["*"] + removeUnused = true +} diff --git a/build.sbt b/build.sbt index d143489..8cc6dfa 100644 --- a/build.sbt +++ b/build.sbt @@ -109,6 +109,7 @@ lazy val rules = projectMatrix publishTo := sonatypePublishToBundle.value, libraryDependencies += "ch.epfl.scala" %% "scalafix-core" % V.scalafixVersion, libraryDependencies += "org.scalatest" %% "scalatest-funsuite" % "3.2.18" % Test, + scalacOptions += "-Ywarn-unused:imports", Compile / sourceGenerators += task { val dir = (Compile / sourceManaged).value Seq( diff --git a/rules/src/main/scala/fix/AddExplicitImplicitTypes.scala b/rules/src/main/scala/fix/AddExplicitImplicitTypes.scala index df10d1a..2379cb3 100644 --- a/rules/src/main/scala/fix/AddExplicitImplicitTypes.scala +++ b/rules/src/main/scala/fix/AddExplicitImplicitTypes.scala @@ -1,9 +1,15 @@ package fix +import scala.meta.Defn +import scala.meta.Mod +import scala.meta.Term +import scala.meta.Type +import scala.meta.XtensionClassifiable +import scala.meta.XtensionCollectionLikeUI import scalafix.Patch import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule -import scala.meta._ +import scalafix.v1.XtensionSeqPatch /** * `implicit val foo = new Foo` diff --git a/rules/src/main/scala/fix/AddLambdaParamParentheses.scala b/rules/src/main/scala/fix/AddLambdaParamParentheses.scala index e8bbace..f8065bb 100644 --- a/rules/src/main/scala/fix/AddLambdaParamParentheses.scala +++ b/rules/src/main/scala/fix/AddLambdaParamParentheses.scala @@ -1,10 +1,13 @@ package fix +import scala.meta.Term +import scala.meta.Token +import scala.meta.XtensionClassifiable +import scala.meta.XtensionCollectionLikeUI import scalafix.Patch import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule -import scala.meta.Term -import scala.meta.Token +import scalafix.v1.XtensionSeqPatch class AddLambdaParamParentheses extends SyntacticRule("AddLambdaParamParentheses") { override def fix(implicit doc: SyntacticDocument): Patch = { diff --git a/rules/src/main/scala/fix/CirceCodec.scala b/rules/src/main/scala/fix/CirceCodec.scala index 46c26c3..141d23f 100644 --- a/rules/src/main/scala/fix/CirceCodec.scala +++ b/rules/src/main/scala/fix/CirceCodec.scala @@ -1,21 +1,23 @@ package fix -import scalafix.Patch -import scalafix.v1.SyntacticDocument -import scalafix.v1.SyntacticRule -import scala.meta.Mod.Annot -import scala.meta.Name.Indeterminate -import scala.meta.Term.Select import scala.meta.Defn import scala.meta.Import import scala.meta.Importee import scala.meta.Importer import scala.meta.Init import scala.meta.Lit +import scala.meta.Mod.Annot +import scala.meta.Name.Indeterminate import scala.meta.Pkg import scala.meta.Source import scala.meta.Term +import scala.meta.Term.Select import scala.meta.Type +import scala.meta.XtensionCollectionLikeUI +import scalafix.Patch +import scalafix.v1.SyntacticDocument +import scalafix.v1.SyntacticRule +import scalafix.v1.XtensionSeqPatch object CirceCodec { private sealed abstract class TypeClass extends Product with Serializable diff --git a/rules/src/main/scala/fix/CollectHead.scala b/rules/src/main/scala/fix/CollectHead.scala index 0a78559..daba320 100644 --- a/rules/src/main/scala/fix/CollectHead.scala +++ b/rules/src/main/scala/fix/CollectHead.scala @@ -1,9 +1,11 @@ package fix +import scala.meta.Term +import scala.meta.XtensionCollectionLikeUI import scalafix.Patch import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule -import scala.meta.Term +import scalafix.v1.XtensionSeqPatch class CollectHead extends SyntacticRule("CollectHead") { override def fix(implicit doc: SyntacticDocument): Patch = { diff --git a/rules/src/main/scala/fix/CollectHeadOption.scala b/rules/src/main/scala/fix/CollectHeadOption.scala index e1e51f9..21e08a6 100644 --- a/rules/src/main/scala/fix/CollectHeadOption.scala +++ b/rules/src/main/scala/fix/CollectHeadOption.scala @@ -1,9 +1,11 @@ package fix +import scala.meta.Term +import scala.meta.XtensionCollectionLikeUI import scalafix.Patch import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule -import scala.meta.Term +import scalafix.v1.XtensionSeqPatch class CollectHeadOption extends SyntacticRule("CollectHeadOption") { override def fix(implicit doc: SyntacticDocument): Patch = { diff --git a/rules/src/main/scala/fix/CompareSameValue.scala b/rules/src/main/scala/fix/CompareSameValue.scala index d1c8208..9060d92 100644 --- a/rules/src/main/scala/fix/CompareSameValue.scala +++ b/rules/src/main/scala/fix/CompareSameValue.scala @@ -1,11 +1,15 @@ package fix import scala.meta.Term +import scala.meta.XtensionClassifiable +import scala.meta.XtensionCollectionLikeUI +import scala.meta.XtensionStructure import scalafix.Patch import scalafix.lint.Diagnostic import scalafix.lint.LintSeverity import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule +import scalafix.v1.XtensionSeqPatch private object CompareSameValue { private object X { diff --git a/rules/src/main/scala/fix/DirectoryAndPackageName.scala b/rules/src/main/scala/fix/DirectoryAndPackageName.scala index 1fa03f7..c513a7a 100644 --- a/rules/src/main/scala/fix/DirectoryAndPackageName.scala +++ b/rules/src/main/scala/fix/DirectoryAndPackageName.scala @@ -1,8 +1,15 @@ package fix -import metaconfig.generic.Surface +import java.io.File +import java.util.Locale import metaconfig.ConfDecoder import metaconfig.Configured +import metaconfig.generic.Surface +import scala.meta.Pkg +import scala.meta.Term +import scala.meta.Tree +import scala.meta.XtensionCollectionLikeUI +import scala.meta.inputs.Input import scalafix.Diagnostic import scalafix.Patch import scalafix.lint.LintSeverity @@ -10,12 +17,6 @@ import scalafix.v1.Configuration import scalafix.v1.Rule import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule -import java.io.File -import java.util.Locale -import scala.meta.Pkg -import scala.meta.Term -import scala.meta.Tree -import scala.meta.inputs.Input case class DirectoryAndPackageNameConfig( baseDirectory: Seq[String], diff --git a/rules/src/main/scala/fix/DiscardSingleConfig.scala b/rules/src/main/scala/fix/DiscardSingleConfig.scala index 52cae11..f125a43 100644 --- a/rules/src/main/scala/fix/DiscardSingleConfig.scala +++ b/rules/src/main/scala/fix/DiscardSingleConfig.scala @@ -1,9 +1,9 @@ package fix +import java.util.Locale import metaconfig.ConfDecoder import metaconfig.generic.Surface import scalafix.lint.LintSeverity -import java.util.Locale case class DiscardSingleConfig( severity: LintSeverity diff --git a/rules/src/main/scala/fix/DiscardValue.scala b/rules/src/main/scala/fix/DiscardValue.scala index 0353281..3f9f911 100644 --- a/rules/src/main/scala/fix/DiscardValue.scala +++ b/rules/src/main/scala/fix/DiscardValue.scala @@ -9,6 +9,7 @@ import scala.meta.Stat import scala.meta.Template import scala.meta.Term import scala.meta.Tree +import scala.meta.XtensionCollectionLikeUI import scala.meta.contrib.XtensionTreeOps import scalafix.Patch import scalafix.lint.Diagnostic @@ -21,6 +22,8 @@ import scalafix.v1.SemanticRule import scalafix.v1.SemanticType import scalafix.v1.TypeRef import scalafix.v1.ValueSignature +import scalafix.v1.XtensionOptionPatch +import scalafix.v1.XtensionSeqPatch import scalafix.v1.XtensionTreeScalafix case class DiscardValueConfig( diff --git a/rules/src/main/scala/fix/DuplicateWildcardImport.scala b/rules/src/main/scala/fix/DuplicateWildcardImport.scala index 6178178..d833d00 100644 --- a/rules/src/main/scala/fix/DuplicateWildcardImport.scala +++ b/rules/src/main/scala/fix/DuplicateWildcardImport.scala @@ -9,11 +9,15 @@ import scala.meta.Importer import scala.meta.Pkg import scala.meta.Source import scala.meta.Token +import scala.meta.XtensionClassifiable +import scala.meta.XtensionCollectionLikeUI +import scala.meta.XtensionStructure import scalafix.Patch import scalafix.v1.Configuration import scalafix.v1.Rule import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule +import scalafix.v1.XtensionSeqPatch case class DuplicateWildcardImportConfig(isScala3: Boolean) diff --git a/rules/src/main/scala/fix/EitherFold.scala b/rules/src/main/scala/fix/EitherFold.scala index ad9538b..f356641 100644 --- a/rules/src/main/scala/fix/EitherFold.scala +++ b/rules/src/main/scala/fix/EitherFold.scala @@ -1,14 +1,17 @@ package fix -import scalafix.Patch -import scalafix.v1.SyntacticDocument -import scalafix.v1.SyntacticRule import scala.meta.Case import scala.meta.Pat import scala.meta.Term import scala.meta.Term.Block +import scala.meta.XtensionClassifiable +import scala.meta.XtensionCollectionLikeUI import scala.meta.contrib.XtensionTreeOps import scala.meta.tokens.Token +import scalafix.Patch +import scalafix.v1.SyntacticDocument +import scalafix.v1.SyntacticRule +import scalafix.v1.XtensionSeqPatch object EitherFold { diff --git a/rules/src/main/scala/fix/EitherGetOrElse.scala b/rules/src/main/scala/fix/EitherGetOrElse.scala index 5070e8e..534a094 100644 --- a/rules/src/main/scala/fix/EitherGetOrElse.scala +++ b/rules/src/main/scala/fix/EitherGetOrElse.scala @@ -1,13 +1,15 @@ package fix -import scalafix.Patch -import scalafix.v1.SyntacticDocument -import scalafix.v1.SyntacticRule import scala.meta.Case import scala.meta.Pat import scala.meta.Term import scala.meta.Term.Block +import scala.meta.XtensionCollectionLikeUI import scala.meta.contrib._ +import scalafix.Patch +import scalafix.v1.SyntacticDocument +import scalafix.v1.SyntacticRule +import scalafix.v1.XtensionSeqPatch object EitherGetOrElse { private abstract class Value(x: String) { diff --git a/rules/src/main/scala/fix/EitherMap.scala b/rules/src/main/scala/fix/EitherMap.scala index da3b2b1..6dbb6ae 100644 --- a/rules/src/main/scala/fix/EitherMap.scala +++ b/rules/src/main/scala/fix/EitherMap.scala @@ -1,11 +1,13 @@ package fix -import scalafix.Patch -import scalafix.v1.SyntacticDocument -import scalafix.v1.SyntacticRule import scala.meta.Case import scala.meta.Pat import scala.meta.Term +import scala.meta.XtensionCollectionLikeUI +import scalafix.Patch +import scalafix.v1.SyntacticDocument +import scalafix.v1.SyntacticRule +import scalafix.v1.XtensionSeqPatch class EitherMap extends SyntacticRule("EitherMap") { private object RightMapIdentity { diff --git a/rules/src/main/scala/fix/EtaExpand.scala b/rules/src/main/scala/fix/EtaExpand.scala index 132d37a..12f4a32 100644 --- a/rules/src/main/scala/fix/EtaExpand.scala +++ b/rules/src/main/scala/fix/EtaExpand.scala @@ -1,10 +1,13 @@ package fix +import scala.meta.Mod +import scala.meta.Term +import scala.meta.XtensionClassifiable +import scala.meta.XtensionCollectionLikeUI import scalafix.Patch import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule -import scala.meta.Mod -import scala.meta.Term +import scalafix.v1.XtensionSeqPatch class EtaExpand extends SyntacticRule("EtaExpand") { override def fix(implicit doc: SyntacticDocument): Patch = { diff --git a/rules/src/main/scala/fix/ExplicitImplicitTypes.scala b/rules/src/main/scala/fix/ExplicitImplicitTypes.scala index 56cca9f..e6138ef 100644 --- a/rules/src/main/scala/fix/ExplicitImplicitTypes.scala +++ b/rules/src/main/scala/fix/ExplicitImplicitTypes.scala @@ -1,15 +1,8 @@ package fix -import metaconfig.generic.Surface import metaconfig.ConfDecoder import metaconfig.Configured -import scalafix.Diagnostic -import scalafix.Patch -import scalafix.lint.LintSeverity -import scalafix.v1.Configuration -import scalafix.v1.Rule -import scalafix.v1.SyntacticDocument -import scalafix.v1.SyntacticRule +import metaconfig.generic.Surface import scala.annotation.tailrec import scala.meta.Ctor import scala.meta.Defn @@ -18,7 +11,17 @@ import scala.meta.Pkg import scala.meta.Template import scala.meta.Term import scala.meta.Tree +import scala.meta.XtensionClassifiable +import scala.meta.XtensionCollectionLikeUI import scala.meta.inputs.Position +import scalafix.Diagnostic +import scalafix.Patch +import scalafix.lint.LintSeverity +import scalafix.v1.Configuration +import scalafix.v1.Rule +import scalafix.v1.SyntacticDocument +import scalafix.v1.SyntacticRule +import scalafix.v1.XtensionSeqPatch case class ExplicitImplicitTypesConfig( excludeLocal: Boolean diff --git a/rules/src/main/scala/fix/ExtendsProductWithSerializable.scala b/rules/src/main/scala/fix/ExtendsProductWithSerializable.scala index 53c6965..7152393 100644 --- a/rules/src/main/scala/fix/ExtendsProductWithSerializable.scala +++ b/rules/src/main/scala/fix/ExtendsProductWithSerializable.scala @@ -5,9 +5,13 @@ import scala.meta.Defn import scala.meta.Mod import scala.meta.Template import scala.meta.Type +import scala.meta.XtensionClassifiable +import scala.meta.XtensionCollectionLikeUI +import scala.meta.typeParamClauseToValues import scalafix.Patch import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule +import scalafix.v1.XtensionSeqPatch /** * @see [[https://nrinaudo.github.io/scala-best-practices/adts/product_with_serializable.html]] diff --git a/rules/src/main/scala/fix/FileNameConsistent.scala b/rules/src/main/scala/fix/FileNameConsistent.scala index 0a68f91..38c0f3e 100644 --- a/rules/src/main/scala/fix/FileNameConsistent.scala +++ b/rules/src/main/scala/fix/FileNameConsistent.scala @@ -1,16 +1,18 @@ package fix import fix.FileNameConsistent._ -import scalafix.Diagnostic -import scalafix.Patch -import scalafix.lint.LintSeverity -import scalafix.v1.SyntacticDocument -import scalafix.v1.SyntacticRule import scala.meta.Defn import scala.meta.Pkg import scala.meta.Tree +import scala.meta.XtensionClassifiable +import scala.meta.XtensionCollectionLikeUI import scala.meta.inputs.Input import scala.meta.inputs.Position +import scalafix.Diagnostic +import scalafix.Patch +import scalafix.lint.LintSeverity +import scalafix.v1.SyntacticDocument +import scalafix.v1.SyntacticRule class FileNameConsistent extends SyntacticRule("FileNameConsistent") { override def isLinter = true diff --git a/rules/src/main/scala/fix/FilterNot.scala b/rules/src/main/scala/fix/FilterNot.scala index 024b5d2..36b069d 100644 --- a/rules/src/main/scala/fix/FilterNot.scala +++ b/rules/src/main/scala/fix/FilterNot.scala @@ -3,9 +3,11 @@ package fix import fix.FilterNot._ import scala.meta.Term import scala.meta.Term.ApplyUnary +import scala.meta.XtensionCollectionLikeUI import scalafix.Patch import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule +import scalafix.v1.XtensionSeqPatch object FilterNot { private object FilterValue { diff --git a/rules/src/main/scala/fix/FilterSize.scala b/rules/src/main/scala/fix/FilterSize.scala index b0aef30..0561eb0 100644 --- a/rules/src/main/scala/fix/FilterSize.scala +++ b/rules/src/main/scala/fix/FilterSize.scala @@ -1,9 +1,11 @@ package fix +import scala.meta.Term +import scala.meta.XtensionCollectionLikeUI import scalafix.Patch import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule -import scala.meta.Term +import scalafix.v1.XtensionSeqPatch class FilterSize extends SyntacticRule("FilterSize") { override def fix(implicit doc: SyntacticDocument): Patch = { diff --git a/rules/src/main/scala/fix/FinalObjectWarn.scala b/rules/src/main/scala/fix/FinalObjectWarn.scala index 081f4ff..c5a4bdf 100644 --- a/rules/src/main/scala/fix/FinalObjectWarn.scala +++ b/rules/src/main/scala/fix/FinalObjectWarn.scala @@ -1,12 +1,16 @@ package fix +import scala.meta.Defn +import scala.meta.Mod +import scala.meta.XtensionClassifiable +import scala.meta.XtensionCollectionLikeUI import scalafix.Patch import scalafix.lint.Diagnostic import scalafix.lint.LintSeverity import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule -import scala.meta.Defn -import scala.meta.Mod +import scalafix.v1.XtensionOptionPatch +import scalafix.v1.XtensionSeqPatch class FinalObjectWarn extends SyntacticRule("FinalObjectWarn") { override def fix(implicit doc: SyntacticDocument): Patch = { diff --git a/rules/src/main/scala/fix/FlatMapCollect.scala b/rules/src/main/scala/fix/FlatMapCollect.scala index 251c2a7..ac7632b 100644 --- a/rules/src/main/scala/fix/FlatMapCollect.scala +++ b/rules/src/main/scala/fix/FlatMapCollect.scala @@ -3,10 +3,14 @@ package fix import scala.meta.Case import scala.meta.Pat import scala.meta.Term +import scala.meta.XtensionClassifiable +import scala.meta.XtensionCollectionLikeUI import scala.meta.tokens.Token import scalafix.Patch import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule +import scalafix.v1.XtensionOptionPatch +import scalafix.v1.XtensionSeqPatch class FlatMapCollect extends SyntacticRule("FlatMapCollect") { override def fix(implicit doc: SyntacticDocument): Patch = { diff --git a/rules/src/main/scala/fix/FlatTraverse.scala b/rules/src/main/scala/fix/FlatTraverse.scala index 290d0c4..7e6b904 100644 --- a/rules/src/main/scala/fix/FlatTraverse.scala +++ b/rules/src/main/scala/fix/FlatTraverse.scala @@ -1,9 +1,11 @@ package fix +import scala.meta.Term +import scala.meta.XtensionCollectionLikeUI import scalafix.Patch import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule -import scala.meta.Term +import scalafix.v1.XtensionSeqPatch class FlatTraverse extends SyntacticRule("FlatTraverse") { override def fix(implicit doc: SyntacticDocument): Patch = { diff --git a/rules/src/main/scala/fix/GroupMap.scala b/rules/src/main/scala/fix/GroupMap.scala index d77623b..c0b8372 100644 --- a/rules/src/main/scala/fix/GroupMap.scala +++ b/rules/src/main/scala/fix/GroupMap.scala @@ -1,9 +1,11 @@ package fix import scala.meta.Term +import scala.meta.XtensionCollectionLikeUI import scalafix.Patch import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule +import scalafix.v1.XtensionSeqPatch class GroupMap extends SyntacticRule("GroupMap") { override def fix(implicit doc: SyntacticDocument): Patch = { diff --git a/rules/src/main/scala/fix/ImplicitValueClass.scala b/rules/src/main/scala/fix/ImplicitValueClass.scala index 9bec8bb..0683f8c 100644 --- a/rules/src/main/scala/fix/ImplicitValueClass.scala +++ b/rules/src/main/scala/fix/ImplicitValueClass.scala @@ -1,19 +1,22 @@ package fix -import scalafix.Patch -import scalafix.v1.SyntacticDocument -import scalafix.v1.SyntacticRule import scala.annotation.tailrec -import scala.meta.Mod.ValParam import scala.meta.Ctor import scala.meta.Defn import scala.meta.Mod +import scala.meta.Mod.ValParam import scala.meta.Pkg import scala.meta.Source import scala.meta.Template import scala.meta.Term import scala.meta.Tree import scala.meta.Type +import scala.meta.XtensionClassifiable +import scala.meta.XtensionCollectionLikeUI +import scalafix.Patch +import scalafix.v1.SyntacticDocument +import scalafix.v1.SyntacticRule +import scalafix.v1.XtensionSeqPatch class ImplicitValueClass extends SyntacticRule("ImplicitValueClass") { diff --git a/rules/src/main/scala/fix/IncorrectScaladocParam.scala b/rules/src/main/scala/fix/IncorrectScaladocParam.scala index a22e361..43ed477 100644 --- a/rules/src/main/scala/fix/IncorrectScaladocParam.scala +++ b/rules/src/main/scala/fix/IncorrectScaladocParam.scala @@ -1,18 +1,20 @@ package fix -import scala.meta.Decl -import scalafix.Patch -import scalafix.v1.SyntacticDocument -import scalafix.v1.SyntacticRule import scala.meta.Ctor +import scala.meta.Decl import scala.meta.Defn import scala.meta.Term import scala.meta.Tree +import scala.meta.XtensionCollectionLikeUI import scala.meta.contrib.DocToken import scala.meta.contrib.XtensionCommentOps import scala.meta.inputs.Position +import scalafix.Patch import scalafix.lint.Diagnostic import scalafix.lint.LintSeverity +import scalafix.v1.SyntacticDocument +import scalafix.v1.SyntacticRule +import scalafix.v1.XtensionSeqPatch class IncorrectScaladocParam extends SyntacticRule("IncorrectScaladocParam") { override def fix(implicit doc: SyntacticDocument): Patch = { diff --git a/rules/src/main/scala/fix/InterpolationToString.scala b/rules/src/main/scala/fix/InterpolationToString.scala index 1f753be..967ee76 100644 --- a/rules/src/main/scala/fix/InterpolationToString.scala +++ b/rules/src/main/scala/fix/InterpolationToString.scala @@ -1,9 +1,11 @@ package fix import scala.meta.Term +import scala.meta.XtensionCollectionLikeUI import scalafix.Patch import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule +import scalafix.v1.XtensionSeqPatch class InterpolationToString extends SyntacticRule("InterpolationToString") { override def fix(implicit doc: SyntacticDocument): Patch = { diff --git a/rules/src/main/scala/fix/InterpolationToStringWarn.scala b/rules/src/main/scala/fix/InterpolationToStringWarn.scala index 09243b7..0a0ada6 100644 --- a/rules/src/main/scala/fix/InterpolationToStringWarn.scala +++ b/rules/src/main/scala/fix/InterpolationToStringWarn.scala @@ -1,11 +1,13 @@ package fix -import scalafix.lint.LintSeverity import scala.meta.Term +import scala.meta.XtensionCollectionLikeUI import scalafix.Diagnostic import scalafix.Patch +import scalafix.lint.LintSeverity import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule +import scalafix.v1.XtensionSeqPatch class InterpolationToStringWarn extends SyntacticRule("InterpolationToStringWarn") { override def fix(implicit doc: SyntacticDocument): Patch = { diff --git a/rules/src/main/scala/fix/IsEmptyNonEmpty.scala b/rules/src/main/scala/fix/IsEmptyNonEmpty.scala index 23f4fa0..b285c81 100644 --- a/rules/src/main/scala/fix/IsEmptyNonEmpty.scala +++ b/rules/src/main/scala/fix/IsEmptyNonEmpty.scala @@ -1,10 +1,12 @@ package fix +import scala.meta.Term +import scala.meta.Term.ApplyUnary +import scala.meta.XtensionCollectionLikeUI import scalafix.Patch import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule -import scala.meta.Term -import scala.meta.Term.ApplyUnary +import scalafix.v1.XtensionSeqPatch class IsEmptyNonEmpty extends SyntacticRule("IsEmptyNonEmpty") { override def fix(implicit doc: SyntacticDocument): Patch = { diff --git a/rules/src/main/scala/fix/JavaURLConstructorsWarn.scala b/rules/src/main/scala/fix/JavaURLConstructorsWarn.scala index ea21f61..c6991d8 100644 --- a/rules/src/main/scala/fix/JavaURLConstructorsWarn.scala +++ b/rules/src/main/scala/fix/JavaURLConstructorsWarn.scala @@ -1,11 +1,13 @@ package fix import scala.meta.Term +import scala.meta.XtensionCollectionLikeUI import scalafix.Patch import scalafix.lint.Diagnostic import scalafix.lint.LintSeverity import scalafix.v1.SemanticDocument import scalafix.v1.SemanticRule +import scalafix.v1.XtensionSeqPatch import scalafix.v1.XtensionTreeScalafix class JavaURLConstructorsWarn extends SemanticRule("JavaURLConstructorsWarn") { diff --git a/rules/src/main/scala/fix/KeySet.scala b/rules/src/main/scala/fix/KeySet.scala index 0bcc3bb..1a94d77 100644 --- a/rules/src/main/scala/fix/KeySet.scala +++ b/rules/src/main/scala/fix/KeySet.scala @@ -1,12 +1,15 @@ package fix +import scala.meta.Term +import scala.meta.XtensionCollectionLikeUI import scalafix.Patch import scalafix.v1.SemanticDocument import scalafix.v1.SemanticRule import scalafix.v1.TypeRef import scalafix.v1.ValueSignature +import scalafix.v1.XtensionOptionPatch +import scalafix.v1.XtensionSeqPatch import scalafix.v1.XtensionTreeScalafix -import scala.meta.Term class KeySet extends SemanticRule("KeySet") { private[this] val map2Types: Set[String] = Set[Class[?]]( diff --git a/rules/src/main/scala/fix/KindProjector.scala b/rules/src/main/scala/fix/KindProjector.scala index 60a29ed..45af62a 100644 --- a/rules/src/main/scala/fix/KindProjector.scala +++ b/rules/src/main/scala/fix/KindProjector.scala @@ -3,12 +3,14 @@ package fix import metaconfig.ConfDecoder import metaconfig.Configured import metaconfig.generic.Surface +import scala.meta.Type +import scala.meta.XtensionCollectionLikeUI import scalafix.Patch import scalafix.v1.Configuration import scalafix.v1.Rule import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule -import scala.meta.Type +import scalafix.v1.XtensionSeqPatch case class KindProjectorConfig( rewriteInfixTypes: Set[String] diff --git a/rules/src/main/scala/fix/LambdaParamParentheses.scala b/rules/src/main/scala/fix/LambdaParamParentheses.scala index 8644078..6e29251 100644 --- a/rules/src/main/scala/fix/LambdaParamParentheses.scala +++ b/rules/src/main/scala/fix/LambdaParamParentheses.scala @@ -1,13 +1,16 @@ package fix +import scala.meta.Position +import scala.meta.Term +import scala.meta.Token +import scala.meta.XtensionClassifiable +import scala.meta.XtensionCollectionLikeUI import scalafix.Diagnostic import scalafix.Patch import scalafix.lint.LintSeverity import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule -import scala.meta.Term -import scala.meta.Token -import scala.meta.Position +import scalafix.v1.XtensionSeqPatch /** * unnecessary since Scala 2.13.11 diff --git a/rules/src/main/scala/fix/LazyZip.scala b/rules/src/main/scala/fix/LazyZip.scala index fc45124..25ff017 100644 --- a/rules/src/main/scala/fix/LazyZip.scala +++ b/rules/src/main/scala/fix/LazyZip.scala @@ -4,9 +4,13 @@ import scala.meta.Case import scala.meta.Pat import scala.meta.Term import scala.meta.Token +import scala.meta.XtensionClassifiable +import scala.meta.XtensionCollectionLikeUI import scalafix.Patch import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule +import scalafix.v1.XtensionOptionPatch +import scalafix.v1.XtensionSeqPatch /** * [[https://github.com/scala/scala/blob/v2.13.12/src/library/scala/collection/LazyZipOps.scala]] diff --git a/rules/src/main/scala/fix/MapDistinctSize.scala b/rules/src/main/scala/fix/MapDistinctSize.scala index 830faa8..eef62a7 100644 --- a/rules/src/main/scala/fix/MapDistinctSize.scala +++ b/rules/src/main/scala/fix/MapDistinctSize.scala @@ -1,9 +1,11 @@ package fix +import scala.meta.Term +import scala.meta.XtensionCollectionLikeUI import scalafix.Patch import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule -import scala.meta.Term +import scalafix.v1.XtensionSeqPatch class MapDistinctSize extends SyntacticRule("MapDistinctSize") { override def fix(implicit doc: SyntacticDocument): Patch = { diff --git a/rules/src/main/scala/fix/MapFlattenFlatMap.scala b/rules/src/main/scala/fix/MapFlattenFlatMap.scala index 33d9875..9757a85 100644 --- a/rules/src/main/scala/fix/MapFlattenFlatMap.scala +++ b/rules/src/main/scala/fix/MapFlattenFlatMap.scala @@ -1,10 +1,14 @@ package fix import scala.meta.Term +import scala.meta.XtensionClassifiable +import scala.meta.XtensionCollectionLikeUI import scala.meta.tokens.Token import scalafix.Patch import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule +import scalafix.v1.XtensionOptionPatch +import scalafix.v1.XtensionSeqPatch class MapFlattenFlatMap extends SyntacticRule("MapFlattenFlatMap") { override def fix(implicit doc: SyntacticDocument): Patch = { diff --git a/rules/src/main/scala/fix/MapSequenceTraverse.scala b/rules/src/main/scala/fix/MapSequenceTraverse.scala index 45141ea..7a10cbb 100644 --- a/rules/src/main/scala/fix/MapSequenceTraverse.scala +++ b/rules/src/main/scala/fix/MapSequenceTraverse.scala @@ -1,11 +1,13 @@ package fix -import scalafix.Patch -import scalafix.v1.SyntacticDocument -import scalafix.v1.SyntacticRule import scala.meta.Term +import scala.meta.XtensionCollectionLikeUI import scala.meta.tokens.Token.LeftBrace import scala.meta.tokens.Token.RightBrace +import scalafix.Patch +import scalafix.v1.SyntacticDocument +import scalafix.v1.SyntacticRule +import scalafix.v1.XtensionSeqPatch class MapSequenceTraverse extends SyntacticRule("MapSequenceTraverse") { override def fix(implicit doc: SyntacticDocument): Patch = { diff --git a/rules/src/main/scala/fix/MapToForeach.scala b/rules/src/main/scala/fix/MapToForeach.scala index 2e8e790..4ee28ea 100644 --- a/rules/src/main/scala/fix/MapToForeach.scala +++ b/rules/src/main/scala/fix/MapToForeach.scala @@ -2,9 +2,11 @@ package fix import scala.meta.Template import scala.meta.Term +import scala.meta.XtensionCollectionLikeUI import scalafix.Patch import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule +import scalafix.v1.XtensionSeqPatch class MapToForeach extends SyntacticRule("MapToForeach") { override def fix(implicit doc: SyntacticDocument): Patch = { diff --git a/rules/src/main/scala/fix/NamedParamOrder.scala b/rules/src/main/scala/fix/NamedParamOrder.scala index 9e50689..4c3a6a9 100644 --- a/rules/src/main/scala/fix/NamedParamOrder.scala +++ b/rules/src/main/scala/fix/NamedParamOrder.scala @@ -3,13 +3,16 @@ package fix import fix.NamedParamOrder.ApplyOrNew import scala.meta.Term import scala.meta.Tree +import scala.meta.XtensionCollectionLikeUI +import scala.meta.XtensionSyntax +import scala.meta.contrib.XtensionTreeOps import scalafix.Patch import scalafix.v1.ClassSignature import scalafix.v1.MethodSignature import scalafix.v1.SemanticDocument import scalafix.v1.SemanticRule +import scalafix.v1.XtensionSeqPatch import scalafix.v1.XtensionTreeScalafix -import scala.meta.contrib.XtensionTreeOps object NamedParamOrder { private object ApplyOrNew { diff --git a/rules/src/main/scala/fix/NoElse.scala b/rules/src/main/scala/fix/NoElse.scala index 7793135..77445c5 100644 --- a/rules/src/main/scala/fix/NoElse.scala +++ b/rules/src/main/scala/fix/NoElse.scala @@ -1,13 +1,15 @@ package fix +import scala.meta.Lit +import scala.meta.Term +import scala.meta.XtensionCollectionLikeUI +import scala.meta.inputs.Position import scalafix.Diagnostic import scalafix.Patch import scalafix.lint.LintSeverity import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule -import scala.meta.Lit -import scala.meta.Term -import scala.meta.inputs.Position +import scalafix.v1.XtensionSeqPatch class NoElse extends SyntacticRule("NoElse") { override def fix(implicit doc: SyntacticDocument): Patch = { diff --git a/rules/src/main/scala/fix/ObjectFinal.scala b/rules/src/main/scala/fix/ObjectFinal.scala index 9814d15..a11c106 100644 --- a/rules/src/main/scala/fix/ObjectFinal.scala +++ b/rules/src/main/scala/fix/ObjectFinal.scala @@ -5,11 +5,15 @@ import scala.meta.Mod import scala.meta.Pat import scala.meta.Term import scala.meta.Type +import scala.meta.XtensionClassifiable +import scala.meta.XtensionCollectionLikeUI +import scala.meta.XtensionStructure import scalafix.Patch import scalafix.lint.Diagnostic import scalafix.lint.LintSeverity import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule +import scalafix.v1.XtensionSeqPatch object ObjectFinal { private val constantTypes: Seq[Type] = { diff --git a/rules/src/main/scala/fix/ObjectSelfType.scala b/rules/src/main/scala/fix/ObjectSelfType.scala index 9ffcb5f..f6772d1 100644 --- a/rules/src/main/scala/fix/ObjectSelfType.scala +++ b/rules/src/main/scala/fix/ObjectSelfType.scala @@ -1,11 +1,13 @@ package fix +import scala.meta.Defn +import scala.meta.XtensionCollectionLikeUI import scalafix.Diagnostic import scalafix.Patch import scalafix.lint.LintSeverity import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule -import scala.meta.Defn +import scalafix.v1.XtensionSeqPatch class ObjectSelfType extends SyntacticRule("ObjectSelfType") { override def isLinter = true diff --git a/rules/src/main/scala/fix/OptionContains.scala b/rules/src/main/scala/fix/OptionContains.scala index 09d59ea..cb65dc0 100644 --- a/rules/src/main/scala/fix/OptionContains.scala +++ b/rules/src/main/scala/fix/OptionContains.scala @@ -1,13 +1,16 @@ package fix -import scalafix.Patch -import scalafix.v1.SyntacticDocument -import scalafix.v1.SyntacticRule import scala.meta.Case import scala.meta.Lit import scala.meta.Pat import scala.meta.Term import scala.meta.Term.ApplyInfix +import scala.meta.XtensionCollectionLikeUI +import scalafix.Patch +import scalafix.v1.SyntacticDocument +import scalafix.v1.SyntacticRule +import scalafix.v1.XtensionOptionPatch +import scalafix.v1.XtensionSeqPatch /** * [[https://github.com/scala/scala/blob/v2.13.12/src/library/scala/Option.scala#L367-L373]] diff --git a/rules/src/main/scala/fix/OptionFilter.scala b/rules/src/main/scala/fix/OptionFilter.scala index c4ddea7..d320939 100644 --- a/rules/src/main/scala/fix/OptionFilter.scala +++ b/rules/src/main/scala/fix/OptionFilter.scala @@ -1,11 +1,13 @@ package fix -import scalafix.Patch -import scalafix.v1.SyntacticDocument -import scalafix.v1.SyntacticRule import scala.meta.Case import scala.meta.Pat import scala.meta.Term +import scala.meta.XtensionCollectionLikeUI +import scalafix.Patch +import scalafix.v1.SyntacticDocument +import scalafix.v1.SyntacticRule +import scalafix.v1.XtensionSeqPatch class OptionFilter extends SyntacticRule("OptionFilter") { override def fix(implicit doc: SyntacticDocument): Patch = { diff --git a/rules/src/main/scala/fix/OptionForallExists.scala b/rules/src/main/scala/fix/OptionForallExists.scala index 59277ba..c7e6082 100644 --- a/rules/src/main/scala/fix/OptionForallExists.scala +++ b/rules/src/main/scala/fix/OptionForallExists.scala @@ -1,14 +1,17 @@ package fix -import scalafix.Patch -import scalafix.v1.SyntacticDocument -import scalafix.v1.SyntacticRule import scala.meta.Case import scala.meta.Lit import scala.meta.Pat import scala.meta.Term import scala.meta.Term.Block +import scala.meta.XtensionClassifiable +import scala.meta.XtensionCollectionLikeUI import scala.meta.tokens.Token +import scalafix.Patch +import scalafix.v1.SyntacticDocument +import scalafix.v1.SyntacticRule +import scalafix.v1.XtensionSeqPatch /** * [[https://github.com/scala/scala/blob/v2.13.12/src/library/scala/Option.scala#L396-L402]] diff --git a/rules/src/main/scala/fix/OptionGetOrElse.scala b/rules/src/main/scala/fix/OptionGetOrElse.scala index b81efa1..b7d38fa 100644 --- a/rules/src/main/scala/fix/OptionGetOrElse.scala +++ b/rules/src/main/scala/fix/OptionGetOrElse.scala @@ -1,13 +1,16 @@ package fix -import scalafix.Patch -import scalafix.v1.SyntacticDocument -import scalafix.v1.SyntacticRule import scala.meta.Case import scala.meta.Pat import scala.meta.Term import scala.meta.Term.Block +import scala.meta.XtensionClassifiable +import scala.meta.XtensionCollectionLikeUI import scala.meta.tokens.Token +import scalafix.Patch +import scalafix.v1.SyntacticDocument +import scalafix.v1.SyntacticRule +import scalafix.v1.XtensionSeqPatch /** * [[https://github.com/scala/scala/blob/v2.13.12/src/library/scala/Option.scala#L190-L196]] diff --git a/rules/src/main/scala/fix/OptionGetWarn.scala b/rules/src/main/scala/fix/OptionGetWarn.scala index 2140f13..4d2bdfb 100644 --- a/rules/src/main/scala/fix/OptionGetWarn.scala +++ b/rules/src/main/scala/fix/OptionGetWarn.scala @@ -1,6 +1,7 @@ package fix import scala.meta.Term +import scala.meta.XtensionCollectionLikeUI import scalafix.Patch import scalafix.lint.Diagnostic import scalafix.lint.LintSeverity @@ -10,6 +11,8 @@ import scalafix.v1.SemanticDocument import scalafix.v1.SemanticRule import scalafix.v1.TypeRef import scalafix.v1.ValueSignature +import scalafix.v1.XtensionOptionPatch +import scalafix.v1.XtensionSeqPatch import scalafix.v1.XtensionTreeScalafix class OptionGetWarn extends SemanticRule("OptionGetWarn") { diff --git a/rules/src/main/scala/fix/OptionMapFlatMap.scala b/rules/src/main/scala/fix/OptionMapFlatMap.scala index 02403e2..31f97f8 100644 --- a/rules/src/main/scala/fix/OptionMapFlatMap.scala +++ b/rules/src/main/scala/fix/OptionMapFlatMap.scala @@ -3,12 +3,14 @@ package fix import scala.meta.Case import scala.meta.Pat import scala.meta.Term -import scalafix.Patch -import scalafix.v1.SyntacticDocument -import scalafix.v1.SyntacticRule +import scala.meta.XtensionCollectionLikeUI import scala.meta.inputs.Position +import scalafix.Patch import scalafix.lint.Diagnostic import scalafix.lint.LintSeverity +import scalafix.v1.SyntacticDocument +import scalafix.v1.SyntacticRule +import scalafix.v1.XtensionSeqPatch class OptionMapFlatMap extends SyntacticRule("OptionMapFlatMap") { private object CaseSome { diff --git a/rules/src/main/scala/fix/OptionMatchToRight.scala b/rules/src/main/scala/fix/OptionMatchToRight.scala index 2fb731d..e2851a5 100644 --- a/rules/src/main/scala/fix/OptionMatchToRight.scala +++ b/rules/src/main/scala/fix/OptionMatchToRight.scala @@ -1,11 +1,13 @@ package fix -import scalafix.Patch -import scalafix.v1.SyntacticDocument -import scalafix.v1.SyntacticRule import scala.meta.Case import scala.meta.Pat import scala.meta.Term +import scala.meta.XtensionCollectionLikeUI +import scalafix.Patch +import scalafix.v1.SyntacticDocument +import scalafix.v1.SyntacticRule +import scalafix.v1.XtensionSeqPatch class OptionMatchToRight extends SyntacticRule("OptionMatchToRight") { private object SomeToRight { diff --git a/rules/src/main/scala/fix/OptionOrElse.scala b/rules/src/main/scala/fix/OptionOrElse.scala index 333a744..d006de9 100644 --- a/rules/src/main/scala/fix/OptionOrElse.scala +++ b/rules/src/main/scala/fix/OptionOrElse.scala @@ -1,13 +1,16 @@ package fix -import scalafix.Patch -import scalafix.v1.SyntacticDocument -import scalafix.v1.SyntacticRule import scala.meta.Case import scala.meta.Pat import scala.meta.Term import scala.meta.Term.Block +import scala.meta.XtensionClassifiable +import scala.meta.XtensionCollectionLikeUI import scala.meta.tokens.Token +import scalafix.Patch +import scalafix.v1.SyntacticDocument +import scalafix.v1.SyntacticRule +import scalafix.v1.XtensionSeqPatch class OptionOrElse extends SyntacticRule("OptionOrElse") { override def fix(implicit doc: SyntacticDocument): Patch = { diff --git a/rules/src/main/scala/fix/OptionWhenUnless.scala b/rules/src/main/scala/fix/OptionWhenUnless.scala index a7ccfbb..b337fda 100644 --- a/rules/src/main/scala/fix/OptionWhenUnless.scala +++ b/rules/src/main/scala/fix/OptionWhenUnless.scala @@ -3,9 +3,11 @@ package fix import scala.meta.Term import scala.meta.Term.Block import scala.meta.Term.If +import scala.meta.XtensionCollectionLikeUI import scalafix.Patch import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule +import scalafix.v1.XtensionSeqPatch object OptionWhenUnless { private object SomeValue { diff --git a/rules/src/main/scala/fix/PartialFunctionCondOpt.scala b/rules/src/main/scala/fix/PartialFunctionCondOpt.scala index 065be18..863879f 100644 --- a/rules/src/main/scala/fix/PartialFunctionCondOpt.scala +++ b/rules/src/main/scala/fix/PartialFunctionCondOpt.scala @@ -1,13 +1,17 @@ package fix -import scalafix.Patch -import scalafix.v1.SyntacticDocument -import scalafix.v1.SyntacticRule import scala.meta.Case import scala.meta.Pat import scala.meta.Term import scala.meta.Tree +import scala.meta.XtensionClassifiable +import scala.meta.XtensionCollectionLikeUI import scala.meta.tokens.Token +import scalafix.Patch +import scalafix.v1.SyntacticDocument +import scalafix.v1.SyntacticRule +import scalafix.v1.XtensionOptionPatch +import scalafix.v1.XtensionSeqPatch class PartialFunctionCondOpt extends SyntacticRule("PartialFunctionCondOpt") { override def fix(implicit doc: SyntacticDocument): Patch = { diff --git a/rules/src/main/scala/fix/RedundantCaseClassVal.scala b/rules/src/main/scala/fix/RedundantCaseClassVal.scala index 998bdad..a575ed5 100644 --- a/rules/src/main/scala/fix/RedundantCaseClassVal.scala +++ b/rules/src/main/scala/fix/RedundantCaseClassVal.scala @@ -1,13 +1,17 @@ package fix +import scala.meta.Ctor +import scala.meta.Defn +import scala.meta.Mod +import scala.meta.XtensionClassifiable +import scala.meta.XtensionCollectionLikeUI +import scala.meta.termParamClauseToValues import scalafix.Patch import scalafix.lint.Diagnostic import scalafix.lint.LintSeverity import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule -import scala.meta.Ctor -import scala.meta.Defn -import scala.meta.Mod +import scalafix.v1.XtensionSeqPatch class RedundantCaseClassVal extends SyntacticRule("RedundantCaseClassVal") { override def fix(implicit doc: SyntacticDocument): Patch = { diff --git a/rules/src/main/scala/fix/RemoveEmptyObject.scala b/rules/src/main/scala/fix/RemoveEmptyObject.scala index a76e76a..6ce9d0f 100644 --- a/rules/src/main/scala/fix/RemoveEmptyObject.scala +++ b/rules/src/main/scala/fix/RemoveEmptyObject.scala @@ -1,10 +1,12 @@ package fix +import scala.meta.Defn +import scala.meta.Template +import scala.meta.XtensionCollectionLikeUI import scalafix.Patch import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule -import scala.meta.Defn -import scala.meta.Template +import scalafix.v1.XtensionSeqPatch class RemoveEmptyObject extends SyntacticRule("RemoveEmptyObject") { override def fix(implicit doc: SyntacticDocument): Patch = { diff --git a/rules/src/main/scala/fix/RemoveIf.scala b/rules/src/main/scala/fix/RemoveIf.scala index 0ec056c..0c92994 100644 --- a/rules/src/main/scala/fix/RemoveIf.scala +++ b/rules/src/main/scala/fix/RemoveIf.scala @@ -2,9 +2,11 @@ package fix import scala.meta.Lit import scala.meta.Term +import scala.meta.XtensionCollectionLikeUI import scalafix.Patch import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule +import scalafix.v1.XtensionSeqPatch object RemoveIf { object True { diff --git a/rules/src/main/scala/fix/RemovePureEff.scala b/rules/src/main/scala/fix/RemovePureEff.scala index db2e3b3..9a42ae1 100644 --- a/rules/src/main/scala/fix/RemovePureEff.scala +++ b/rules/src/main/scala/fix/RemovePureEff.scala @@ -1,12 +1,14 @@ package fix -import scalafix.Patch -import scalafix.v1.SyntacticDocument -import scalafix.v1.SyntacticRule import scala.meta.Enumerator import scala.meta.Term -import scala.meta.Type import scala.meta.Term.ApplyType +import scala.meta.Type +import scala.meta.XtensionCollectionLikeUI +import scalafix.Patch +import scalafix.v1.SyntacticDocument +import scalafix.v1.SyntacticRule +import scalafix.v1.XtensionSeqPatch class RemovePureEff extends SyntacticRule("RemovePureEff") { override def fix(implicit doc: SyntacticDocument): Patch = { diff --git a/rules/src/main/scala/fix/RemoveSamePackageImport.scala b/rules/src/main/scala/fix/RemoveSamePackageImport.scala index ddec105..289facc 100644 --- a/rules/src/main/scala/fix/RemoveSamePackageImport.scala +++ b/rules/src/main/scala/fix/RemoveSamePackageImport.scala @@ -1,7 +1,10 @@ package fix -import scalafix.v1._ -import scala.meta._ +import scala.meta.Importee +import scala.meta.Pkg +import scalafix.Patch +import scalafix.v1.SyntacticDocument +import scalafix.v1.SyntacticRule class RemoveSamePackageImport extends SyntacticRule("RemoveSamePackageImport") { diff --git a/rules/src/main/scala/fix/RemoveStringInterpolation.scala b/rules/src/main/scala/fix/RemoveStringInterpolation.scala index 677ddc6..94a831d 100644 --- a/rules/src/main/scala/fix/RemoveStringInterpolation.scala +++ b/rules/src/main/scala/fix/RemoveStringInterpolation.scala @@ -1,9 +1,12 @@ package fix +import scala.meta.Term +import scala.meta.XtensionCollectionLikeUI +import scala.meta.XtensionSyntax import scalafix.Patch import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule -import scala.meta.Term +import scalafix.v1.XtensionSeqPatch class RemoveStringInterpolation extends SyntacticRule("RemoveStringInterpolation") { override def fix(implicit doc: SyntacticDocument): Patch = { diff --git a/rules/src/main/scala/fix/RemoveUselessParamComments.scala b/rules/src/main/scala/fix/RemoveUselessParamComments.scala index d9ab265..eec4c1a 100644 --- a/rules/src/main/scala/fix/RemoveUselessParamComments.scala +++ b/rules/src/main/scala/fix/RemoveUselessParamComments.scala @@ -2,14 +2,16 @@ package fix import java.util.Locale import scala.meta.Decl -import scalafix.Patch -import scalafix.v1.SyntacticDocument -import scalafix.v1.SyntacticRule import scala.meta.Defn import scala.meta.Tree +import scala.meta.XtensionCollectionLikeUI import scala.meta.contrib.AssociatedComments import scala.meta.contrib.DocToken import scala.meta.contrib.XtensionCommentOps +import scalafix.Patch +import scalafix.v1.SyntacticDocument +import scalafix.v1.SyntacticRule +import scalafix.v1.XtensionSeqPatch class RemoveUselessParamComments extends SyntacticRule("RemoveUselessParamComments") { override def fix(implicit doc: SyntacticDocument): Patch = { diff --git a/rules/src/main/scala/fix/RepeatedRewrite.scala b/rules/src/main/scala/fix/RepeatedRewrite.scala index 26d9282..a4746b3 100644 --- a/rules/src/main/scala/fix/RepeatedRewrite.scala +++ b/rules/src/main/scala/fix/RepeatedRewrite.scala @@ -1,10 +1,14 @@ package fix import scala.meta.Term +import scala.meta.XtensionClassifiable +import scala.meta.XtensionCollectionLikeUI +import scala.meta.tokens.Token import scalafix.Patch import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule -import scala.meta.tokens.Token +import scalafix.v1.XtensionOptionPatch +import scalafix.v1.XtensionSeqPatch class RepeatedRewrite extends SyntacticRule("RepeatedRewrite") { override def fix(implicit doc: SyntacticDocument): Patch = { diff --git a/rules/src/main/scala/fix/ReplaceFill.scala b/rules/src/main/scala/fix/ReplaceFill.scala index e980753..1f85df1 100644 --- a/rules/src/main/scala/fix/ReplaceFill.scala +++ b/rules/src/main/scala/fix/ReplaceFill.scala @@ -1,13 +1,16 @@ package fix -import scalafix.Patch -import scalafix.v1.SyntacticDocument -import scalafix.v1.SyntacticRule import scala.meta.Enumerator import scala.meta.Lit import scala.meta.Name import scala.meta.Pat import scala.meta.Term +import scala.meta.XtensionClassifiable +import scala.meta.XtensionCollectionLikeUI +import scalafix.Patch +import scalafix.v1.SyntacticDocument +import scalafix.v1.SyntacticRule +import scalafix.v1.XtensionSeqPatch class ReplaceFill extends SyntacticRule("ReplaceFill") { diff --git a/rules/src/main/scala/fix/ReplacePlaceholder.scala b/rules/src/main/scala/fix/ReplacePlaceholder.scala index 5168290..81c1abb 100644 --- a/rules/src/main/scala/fix/ReplacePlaceholder.scala +++ b/rules/src/main/scala/fix/ReplacePlaceholder.scala @@ -1,10 +1,13 @@ package fix +import scala.meta.Mod +import scala.meta.Term +import scala.meta.XtensionClassifiable +import scala.meta.XtensionCollectionLikeUI import scalafix.Patch import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule -import scala.meta.Mod -import scala.meta.Term +import scalafix.v1.XtensionSeqPatch class ReplacePlaceholder extends SyntacticRule("ReplacePlaceholder") { override def fix(implicit doc: SyntacticDocument): Patch = { diff --git a/rules/src/main/scala/fix/ReplaceSymbolLiterals.scala b/rules/src/main/scala/fix/ReplaceSymbolLiterals.scala index 5869f01..cf28344 100644 --- a/rules/src/main/scala/fix/ReplaceSymbolLiterals.scala +++ b/rules/src/main/scala/fix/ReplaceSymbolLiterals.scala @@ -1,9 +1,10 @@ package fix +import scala.meta.Lit +import scala.meta.XtensionCollectionLikeUI import scalafix.v1.Patch import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule -import scala.meta.Lit class ReplaceSymbolLiterals extends SyntacticRule("ReplaceSymbolLiterals") { diff --git a/rules/src/main/scala/fix/ReuseInstances.scala b/rules/src/main/scala/fix/ReuseInstances.scala index 27c9f61..13561b1 100644 --- a/rules/src/main/scala/fix/ReuseInstances.scala +++ b/rules/src/main/scala/fix/ReuseInstances.scala @@ -3,10 +3,13 @@ package fix import scala.meta.Case import scala.meta.Pat import scala.meta.Term +import scala.meta.XtensionCollectionLikeUI +import scala.meta.XtensionSyntax import scala.meta.contrib.XtensionTreeOps import scalafix.Patch import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule +import scalafix.v1.XtensionSeqPatch class ReuseInstances extends SyntacticRule("ReuseInstances") { override def fix(implicit doc: SyntacticDocument): Patch = { diff --git a/rules/src/main/scala/fix/SameParamOverloading.scala b/rules/src/main/scala/fix/SameParamOverloading.scala index 236cc67..1002e09 100644 --- a/rules/src/main/scala/fix/SameParamOverloading.scala +++ b/rules/src/main/scala/fix/SameParamOverloading.scala @@ -6,11 +6,15 @@ import scala.meta.Member import scala.meta.Mod import scala.meta.Stat import scala.meta.Template +import scala.meta.XtensionClassifiable +import scala.meta.XtensionCollectionLikeUI +import scala.meta.XtensionStructure import scalafix.Diagnostic import scalafix.Patch import scalafix.lint.LintSeverity import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule +import scalafix.v1.XtensionSeqPatch object SameParamOverloading { private sealed abstract class Method extends Product with Serializable { diff --git a/rules/src/main/scala/fix/Scala3ImportRewrite.scala b/rules/src/main/scala/fix/Scala3ImportRewrite.scala index 9a7b5a0..4d25942 100644 --- a/rules/src/main/scala/fix/Scala3ImportRewrite.scala +++ b/rules/src/main/scala/fix/Scala3ImportRewrite.scala @@ -1,9 +1,11 @@ package fix +import scala.meta.Importee +import scala.meta.XtensionCollectionLikeUI import scalafix.Patch import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule -import scala.meta.Importee +import scalafix.v1.XtensionSeqPatch class Scala3ImportRewrite extends SyntacticRule("Scala3ImportRewrite") { override def fix(implicit doc: SyntacticDocument): Patch = { diff --git a/rules/src/main/scala/fix/Scala3ImportWarn.scala b/rules/src/main/scala/fix/Scala3ImportWarn.scala index 7151c13..8d38bb3 100644 --- a/rules/src/main/scala/fix/Scala3ImportWarn.scala +++ b/rules/src/main/scala/fix/Scala3ImportWarn.scala @@ -1,12 +1,14 @@ package fix -import scalafix.Patch -import scalafix.v1.SyntacticDocument -import scalafix.v1.SyntacticRule import scala.meta.Importee +import scala.meta.XtensionCollectionLikeUI import scala.meta.inputs.Position +import scalafix.Patch import scalafix.lint.Diagnostic import scalafix.lint.LintSeverity +import scalafix.v1.SyntacticDocument +import scalafix.v1.SyntacticRule +import scalafix.v1.XtensionSeqPatch class Scala3ImportWarn extends SyntacticRule("Scala3ImportWarn") { override def isLinter = true diff --git a/rules/src/main/scala/fix/Scala3Placeholder.scala b/rules/src/main/scala/fix/Scala3Placeholder.scala index 9615aad..4879aae 100644 --- a/rules/src/main/scala/fix/Scala3Placeholder.scala +++ b/rules/src/main/scala/fix/Scala3Placeholder.scala @@ -1,13 +1,15 @@ package fix -import scalafix.Patch -import scalafix.v1.SyntacticDocument -import scalafix.v1.SyntacticRule import scala.meta.Type import scala.meta.Type.Bounds +import scala.meta.XtensionCollectionLikeUI import scala.meta.inputs.Position +import scalafix.Patch import scalafix.lint.Diagnostic import scalafix.lint.LintSeverity +import scalafix.v1.SyntacticDocument +import scalafix.v1.SyntacticRule +import scalafix.v1.XtensionSeqPatch class Scala3Placeholder extends SyntacticRule("Scala3Placeholder") { override def fix(implicit doc: SyntacticDocument): Patch = { diff --git a/rules/src/main/scala/fix/ScalaApp.scala b/rules/src/main/scala/fix/ScalaApp.scala index d5f285e..19e9718 100644 --- a/rules/src/main/scala/fix/ScalaApp.scala +++ b/rules/src/main/scala/fix/ScalaApp.scala @@ -1,14 +1,17 @@ package fix -import scalafix.Patch -import scalafix.v1.SyntacticDocument -import scalafix.v1.SyntacticRule -import scala.meta.tokens.Token import scala.meta.Defn import scala.meta.Init import scala.meta.Pkg import scala.meta.Template import scala.meta.Type +import scala.meta.XtensionClassifiable +import scala.meta.XtensionCollectionLikeUI +import scala.meta.tokens.Token +import scalafix.Patch +import scalafix.v1.SyntacticDocument +import scalafix.v1.SyntacticRule +import scalafix.v1.XtensionSeqPatch /** * @see [[https://docs.scala-lang.org/scala3/book/methods-main-methods.html]] diff --git a/rules/src/main/scala/fix/ScalazEitherInfix.scala b/rules/src/main/scala/fix/ScalazEitherInfix.scala index 47171a0..823eb0b 100644 --- a/rules/src/main/scala/fix/ScalazEitherInfix.scala +++ b/rules/src/main/scala/fix/ScalazEitherInfix.scala @@ -1,7 +1,10 @@ package fix -import scala.meta._ -import scalafix.v1._ +import scala.meta.Type +import scalafix.Patch +import scalafix.v1.SemanticDocument +import scalafix.v1.SemanticRule +import scalafix.v1.XtensionTreeScalafix class ScalazEitherInfix extends SemanticRule("ScalazEitherInfix") { override def fix(implicit doc: SemanticDocument): Patch = { diff --git a/rules/src/main/scala/fix/SimplifyForYield.scala b/rules/src/main/scala/fix/SimplifyForYield.scala index b404acb..2e2effa 100644 --- a/rules/src/main/scala/fix/SimplifyForYield.scala +++ b/rules/src/main/scala/fix/SimplifyForYield.scala @@ -1,12 +1,15 @@ package fix -import scalafix.patch.Patch -import scalafix.v1.SyntacticDocument -import scalafix.v1.SyntacticRule import scala.meta.Enumerator.Generator import scala.meta.Pat import scala.meta.Term import scala.meta.Token +import scala.meta.XtensionClassifiable +import scala.meta.XtensionCollectionLikeUI +import scalafix.patch.Patch +import scalafix.v1.SyntacticDocument +import scalafix.v1.SyntacticRule +import scalafix.v1.XtensionSeqPatch class SimplifyForYield extends SyntacticRule("SimplifyForYield") { override def fix(implicit doc: SyntacticDocument): Patch = { diff --git a/rules/src/main/scala/fix/SizeToLength.scala b/rules/src/main/scala/fix/SizeToLength.scala index 76cd098..23f3a52 100644 --- a/rules/src/main/scala/fix/SizeToLength.scala +++ b/rules/src/main/scala/fix/SizeToLength.scala @@ -1,12 +1,15 @@ package fix +import scala.meta.Term +import scala.meta.XtensionCollectionLikeUI import scalafix.Patch import scalafix.v1.SemanticDocument import scalafix.v1.SemanticRule import scalafix.v1.TypeRef import scalafix.v1.ValueSignature +import scalafix.v1.XtensionOptionPatch +import scalafix.v1.XtensionSeqPatch import scalafix.v1.XtensionTreeScalafix -import scala.meta.Term class SizeToLength extends SemanticRule("SizeToLength") { override def fix(implicit doc: SemanticDocument): Patch = { diff --git a/rules/src/main/scala/fix/SlickFilter.scala b/rules/src/main/scala/fix/SlickFilter.scala index c02a03e..1ef0c74 100644 --- a/rules/src/main/scala/fix/SlickFilter.scala +++ b/rules/src/main/scala/fix/SlickFilter.scala @@ -4,13 +4,15 @@ import scala.meta.Case import scala.meta.Lit import scala.meta.Pat import scala.meta.Term -import scala.meta.Tree -import scala.meta.Type import scala.meta.Term.ApplyInfix import scala.meta.Term.Block +import scala.meta.Tree +import scala.meta.Type +import scala.meta.XtensionCollectionLikeUI import scalafix.Patch import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule +import scalafix.v1.XtensionSeqPatch object SlickFilter { private object CaseSome { diff --git a/rules/src/main/scala/fix/StringFormatToInterpolation.scala b/rules/src/main/scala/fix/StringFormatToInterpolation.scala index 69e4a5f..3abd71d 100644 --- a/rules/src/main/scala/fix/StringFormatToInterpolation.scala +++ b/rules/src/main/scala/fix/StringFormatToInterpolation.scala @@ -1,10 +1,14 @@ package fix +import scala.meta.Lit +import scala.meta.Term +import scala.meta.XtensionClassifiable +import scala.meta.XtensionCollectionLikeUI +import scala.meta.XtensionSyntax import scalafix.Patch import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule -import scala.meta.Lit -import scala.meta.Term +import scalafix.v1.XtensionSeqPatch private object StringFormatToInterpolation { private object Extract { diff --git a/rules/src/main/scala/fix/SyntacticOrganizeImports.scala b/rules/src/main/scala/fix/SyntacticOrganizeImports.scala index c09ec75..5159968 100644 --- a/rules/src/main/scala/fix/SyntacticOrganizeImports.scala +++ b/rules/src/main/scala/fix/SyntacticOrganizeImports.scala @@ -1,16 +1,21 @@ package fix -import scalafix.Patch -import scalafix.v1.SyntacticDocument -import scalafix.v1.SyntacticRule +import scala.annotation.tailrec import scala.meta.Import -import scala.meta.Importer import scala.meta.Importee +import scala.meta.Importer import scala.meta.Pkg +import scala.meta.XtensionClassifiable +import scala.meta.XtensionCollectionLikeUI +import scala.meta.XtensionSyntax import scala.meta.inputs.Position +import scalafix.Patch import scalafix.lint.Diagnostic import scalafix.lint.LintSeverity -import scala.annotation.tailrec +import scalafix.v1.SyntacticDocument +import scalafix.v1.SyntacticRule +import scalafix.v1.XtensionOptionPatch +import scalafix.v1.XtensionSeqPatch class SyntacticOrganizeImports extends SyntacticRule("SyntacticOrganizeImports") { diff --git a/rules/src/main/scala/fix/ThrowableToNonFatal.scala b/rules/src/main/scala/fix/ThrowableToNonFatal.scala index 272f2c0..be8a29e 100644 --- a/rules/src/main/scala/fix/ThrowableToNonFatal.scala +++ b/rules/src/main/scala/fix/ThrowableToNonFatal.scala @@ -1,7 +1,12 @@ package fix -import scalafix.v1._ -import scala.meta._ +import scala.meta.Case +import scala.meta.Pat +import scala.meta.Type +import scala.meta.XtensionQuasiquoteImporter +import scalafix.Patch +import scalafix.v1.SemanticDocument +import scalafix.v1.SemanticRule class ThrowableToNonFatal extends SemanticRule("ThrowableToNonFatal") { override def fix(implicit doc: SemanticDocument): Patch = { diff --git a/rules/src/main/scala/fix/UnnecessaryCase.scala b/rules/src/main/scala/fix/UnnecessaryCase.scala index dafd9bf..78667dd 100644 --- a/rules/src/main/scala/fix/UnnecessaryCase.scala +++ b/rules/src/main/scala/fix/UnnecessaryCase.scala @@ -1,12 +1,15 @@ package fix -import scalafix.Patch -import scalafix.v1.SyntacticDocument -import scalafix.v1.SyntacticRule import scala.meta.Case import scala.meta.Pat import scala.meta.Term +import scala.meta.XtensionClassifiable +import scala.meta.XtensionCollectionLikeUI import scala.meta.tokens.Token +import scalafix.Patch +import scalafix.v1.SyntacticDocument +import scalafix.v1.SyntacticRule +import scalafix.v1.XtensionSeqPatch class UnnecessaryCase extends SyntacticRule("UnnecessaryCase") { override def fix(implicit doc: SyntacticDocument): Patch = { diff --git a/rules/src/main/scala/fix/UnnecessaryMatch.scala b/rules/src/main/scala/fix/UnnecessaryMatch.scala index bca0524..5e63276 100644 --- a/rules/src/main/scala/fix/UnnecessaryMatch.scala +++ b/rules/src/main/scala/fix/UnnecessaryMatch.scala @@ -1,11 +1,13 @@ package fix +import scala.meta.Term +import scala.meta.Token +import scala.meta.XtensionClassifiable +import scala.meta.XtensionCollectionLikeUI import scalafix.Patch import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule -import scala.meta.Term -import scala.meta.Token -import scala.meta.tokens.Token.Keyword +import scalafix.v1.XtensionSeqPatch class UnnecessaryMatch extends SyntacticRule("UnnecessaryMatch") { override def fix(implicit doc: SyntacticDocument): Patch = { diff --git a/rules/src/main/scala/fix/UnnecessarySort.scala b/rules/src/main/scala/fix/UnnecessarySort.scala index 8e93a8d..a8d22fe 100644 --- a/rules/src/main/scala/fix/UnnecessarySort.scala +++ b/rules/src/main/scala/fix/UnnecessarySort.scala @@ -1,12 +1,14 @@ package fix +import scala.meta.Position +import scala.meta.Term +import scala.meta.XtensionCollectionLikeUI import scalafix.Diagnostic import scalafix.Patch import scalafix.lint.LintSeverity import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule -import scala.meta.Term -import scala.meta.Position +import scalafix.v1.XtensionSeqPatch object UnnecessarySort { val scala213Methods: Map[String, String] = Map( diff --git a/rules/src/main/scala/fix/UnnecessarySortRewrite.scala b/rules/src/main/scala/fix/UnnecessarySortRewrite.scala index 5fa46b6..245cc90 100644 --- a/rules/src/main/scala/fix/UnnecessarySortRewrite.scala +++ b/rules/src/main/scala/fix/UnnecessarySortRewrite.scala @@ -4,14 +4,16 @@ import metaconfig.ConfDecoder import metaconfig.ConfError import metaconfig.Configured import metaconfig.generic.Surface +import scala.meta.Pkg +import scala.meta.Source +import scala.meta.Term +import scala.meta.XtensionCollectionLikeUI import scalafix.Patch import scalafix.v1.Configuration import scalafix.v1.Rule import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule -import scala.meta.Pkg -import scala.meta.Source -import scala.meta.Term +import scalafix.v1.XtensionSeqPatch case class UnnecessarySortRewriteConfig(rewriteConfig: UnnecessarySortRewriteConfig.RewriteConfig) diff --git a/rules/src/main/scala/fix/UnusedConstructorParams.scala b/rules/src/main/scala/fix/UnusedConstructorParams.scala index 4484a34..edcb83a 100644 --- a/rules/src/main/scala/fix/UnusedConstructorParams.scala +++ b/rules/src/main/scala/fix/UnusedConstructorParams.scala @@ -1,13 +1,17 @@ package fix +import scala.meta.Defn +import scala.meta.Mod +import scala.meta.XtensionClassifiable +import scala.meta.XtensionCollectionLikeUI +import scala.meta.inputs.Position +import scala.meta.termParamClauseToValues import scalafix.Patch import scalafix.lint.Diagnostic import scalafix.lint.LintSeverity import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule -import scala.meta.Defn -import scala.meta.Mod -import scala.meta.inputs.Position +import scalafix.v1.XtensionSeqPatch class UnusedConstructorParams extends SyntacticRule("UnusedConstructorParams") { override def isLinter = true diff --git a/rules/src/main/scala/fix/UnusedTypeParams.scala b/rules/src/main/scala/fix/UnusedTypeParams.scala index 8ad06e9..ee176f2 100644 --- a/rules/src/main/scala/fix/UnusedTypeParams.scala +++ b/rules/src/main/scala/fix/UnusedTypeParams.scala @@ -5,11 +5,15 @@ import scala.meta.Mod import scala.meta.Position import scala.meta.Term import scala.meta.Type +import scala.meta.XtensionClassifiable +import scala.meta.XtensionCollectionLikeUI +import scala.meta.typeParamClauseToValues import scalafix.Diagnostic import scalafix.Patch import scalafix.lint.LintSeverity import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule +import scalafix.v1.XtensionSeqPatch class UnusedTypeParams extends SyntacticRule("UnusedTypeParams") { diff --git a/rules/src/main/scala/fix/UselessParamCommentsWarn.scala b/rules/src/main/scala/fix/UselessParamCommentsWarn.scala index cb3eafa..f79b8e5 100644 --- a/rules/src/main/scala/fix/UselessParamCommentsWarn.scala +++ b/rules/src/main/scala/fix/UselessParamCommentsWarn.scala @@ -1,15 +1,18 @@ package fix import java.util.Locale +import scala.meta.Defn +import scala.meta.XtensionCollectionLikeUI +import scala.meta.contrib.DocToken +import scala.meta.contrib.XtensionCommentOps +import scala.meta.inputs.Position import scalafix.Patch import scalafix.lint.Diagnostic import scalafix.lint.LintSeverity import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule -import scala.meta.Defn -import scala.meta.inputs.Position -import scala.meta.contrib.DocToken -import scala.meta.contrib.XtensionCommentOps +import scalafix.v1.XtensionOptionPatch +import scalafix.v1.XtensionSeqPatch class UselessParamCommentsWarn extends SyntacticRule("UselessParamCommentsWarn") { override def fix(implicit doc: SyntacticDocument): Patch = { diff --git a/rules/src/main/scala/fix/WithFilter.scala b/rules/src/main/scala/fix/WithFilter.scala index 1bcd300..b00bed3 100644 --- a/rules/src/main/scala/fix/WithFilter.scala +++ b/rules/src/main/scala/fix/WithFilter.scala @@ -1,9 +1,11 @@ package fix +import scala.meta.Term +import scala.meta.XtensionCollectionLikeUI import scalafix.Patch import scalafix.v1.SyntacticDocument import scalafix.v1.SyntacticRule -import scala.meta.Term +import scalafix.v1.XtensionSeqPatch class WithFilter extends SyntacticRule("WithFilter") { override def fix(implicit doc: SyntacticDocument): Patch = { diff --git a/rules/src/test/scala/fix/IncorrectScaladocParamTest.scala b/rules/src/test/scala/fix/IncorrectScaladocParamTest.scala index 5deb560..7c50213 100644 --- a/rules/src/test/scala/fix/IncorrectScaladocParamTest.scala +++ b/rules/src/test/scala/fix/IncorrectScaladocParamTest.scala @@ -1,10 +1,10 @@ package fix import org.scalatest.funsuite.AnyFunSuite +import scala.meta.inputs.Input import scalafix.internal.config.ScalaVersion import scalafix.lint.LintSeverity import scalafix.v1.SyntacticDocument -import scala.meta.inputs.Input class IncorrectScaladocParamTest extends AnyFunSuite { test("Scala 2") {