From 869e4279bf3201d0bd1e573b683b8e1e6eb659b2 Mon Sep 17 00:00:00 2001 From: Ondra Pelech Date: Mon, 28 Dec 2020 03:57:37 +0100 Subject: [PATCH] Use new IntelliJ import order (#143) --- README.adoc | 5 ++--- output/src/main/scala/fix/ExpandRelativeRootPackage.scala | 6 +++--- .../src/main/scala/fix/ExplicitlyImportedImplicits.scala | 4 ++-- output/src/main/scala/fix/GlobalImportsOnly.scala | 1 - output/src/main/scala/fix/ImportsOrderKeep.scala | 8 ++++---- output/src/main/scala/fix/ImportsOrderSymbolsFirst.scala | 8 ++++---- .../main/scala/fix/nested/NestedPackageWithBraces.scala | 5 ++--- rules/src/main/scala/fix/OrganizeImportsConfig.scala | 5 ++--- 8 files changed, 19 insertions(+), 23 deletions(-) diff --git a/README.adoc b/README.adoc index 10849dc..27a4ebb 100644 --- a/README.adoc +++ b/README.adoc @@ -95,7 +95,7 @@ OrganizeImports { expandRelative = false groupExplicitlyImportedImplicitsSeparately = false groupedImports = Explode - groups = ["re:javax?\\.", "scala.", "*"] + groups = ["*", "re:(javax?|scala)\\."] importSelectorsOrder = Ascii importsOrder = Ascii removeUnused = true @@ -673,9 +673,8 @@ OrganizeImports.groups = ["re:javax?\\.", "scala."] [source,hocon] ---- [ - "re:javax?\\." - "scala." "*" + "re:(javax?|scala)\\." ] ---- diff --git a/output/src/main/scala/fix/ExpandRelativeRootPackage.scala b/output/src/main/scala/fix/ExpandRelativeRootPackage.scala index 251a457..0e0f0e4 100644 --- a/output/src/main/scala/fix/ExpandRelativeRootPackage.scala +++ b/output/src/main/scala/fix/ExpandRelativeRootPackage.scala @@ -1,9 +1,9 @@ package fix -import scala.util.control -import scala.util.control.NonFatal - import _root_.scala.collection.mutable.ArrayBuffer import _root_.scala.util +import scala.util.control +import scala.util.control.NonFatal + object ExpandRelativeRootPackage diff --git a/output/src/main/scala/fix/ExplicitlyImportedImplicits.scala b/output/src/main/scala/fix/ExplicitlyImportedImplicits.scala index e29bbfb..25905cb 100644 --- a/output/src/main/scala/fix/ExplicitlyImportedImplicits.scala +++ b/output/src/main/scala/fix/ExplicitlyImportedImplicits.scala @@ -1,10 +1,10 @@ package fix -import scala.concurrent.ExecutionContext - import fix.Implicits.a.nonImplicit import fix.Implicits.b._ +import scala.concurrent.ExecutionContext + import ExecutionContext.Implicits.global import fix.Implicits.a.intImplicit import fix.Implicits.a.stringImplicit diff --git a/output/src/main/scala/fix/GlobalImportsOnly.scala b/output/src/main/scala/fix/GlobalImportsOnly.scala index 1f18c5b..1928171 100644 --- a/output/src/main/scala/fix/GlobalImportsOnly.scala +++ b/output/src/main/scala/fix/GlobalImportsOnly.scala @@ -2,7 +2,6 @@ package fix import java.sql.DriverManager import java.time.Clock - import scala.collection.mutable import scala.concurrent.duration.Duration diff --git a/output/src/main/scala/fix/ImportsOrderKeep.scala b/output/src/main/scala/fix/ImportsOrderKeep.scala index 4914136..6001a1c 100644 --- a/output/src/main/scala/fix/ImportsOrderKeep.scala +++ b/output/src/main/scala/fix/ImportsOrderKeep.scala @@ -1,12 +1,12 @@ package fix +import fix.QuotedIdent.`a.b`.`{ d }`.e +import fix.QuotedIdent._ +import fix.QuotedIdent.`a.b`.{c => _, _} + import scala.concurrent.ExecutionContext.Implicits._ import scala.concurrent.duration import scala.concurrent._ import scala.concurrent.{Promise, Future} -import fix.QuotedIdent.`a.b`.`{ d }`.e -import fix.QuotedIdent._ -import fix.QuotedIdent.`a.b`.{c => _, _} - object ImportsOrderKeep diff --git a/output/src/main/scala/fix/ImportsOrderSymbolsFirst.scala b/output/src/main/scala/fix/ImportsOrderSymbolsFirst.scala index 474aa8a..d43c2b3 100644 --- a/output/src/main/scala/fix/ImportsOrderSymbolsFirst.scala +++ b/output/src/main/scala/fix/ImportsOrderSymbolsFirst.scala @@ -1,12 +1,12 @@ package fix +import fix.QuotedIdent._ +import fix.QuotedIdent.`a.b`.{c => _, _} +import fix.QuotedIdent.`a.b`.`{ d }`.e + import scala.concurrent._ import scala.concurrent.{Promise, Future} import scala.concurrent.ExecutionContext.Implicits._ import scala.concurrent.duration -import fix.QuotedIdent._ -import fix.QuotedIdent.`a.b`.{c => _, _} -import fix.QuotedIdent.`a.b`.`{ d }`.e - object ImportsOrderSymbolsFirst diff --git a/output/src/main/scala/fix/nested/NestedPackageWithBraces.scala b/output/src/main/scala/fix/nested/NestedPackageWithBraces.scala index 22e2d98..bc8cfc5 100644 --- a/output/src/main/scala/fix/nested/NestedPackageWithBraces.scala +++ b/output/src/main/scala/fix/nested/NestedPackageWithBraces.scala @@ -1,13 +1,12 @@ package fix { package nested { + import sun.misc.BASE64Encoder + import java.time.Clock import javax.annotation.Generated - import scala.collection.JavaConverters._ import scala.concurrent.ExecutionContext - import sun.misc.BASE64Encoder - object NestedPackageWithBraces } } diff --git a/rules/src/main/scala/fix/OrganizeImportsConfig.scala b/rules/src/main/scala/fix/OrganizeImportsConfig.scala index 9e14ccd..86eaed3 100644 --- a/rules/src/main/scala/fix/OrganizeImportsConfig.scala +++ b/rules/src/main/scala/fix/OrganizeImportsConfig.scala @@ -52,9 +52,8 @@ final case class OrganizeImportsConfig( groupExplicitlyImportedImplicitsSeparately: Boolean = false, groupedImports: GroupedImports = GroupedImports.Explode, groups: Seq[String] = Seq( - "re:javax?\\.", - "scala.", - "*" + "*", + "re:(javax?|scala)\\." ), importSelectorsOrder: ImportSelectorsOrder = ImportSelectorsOrder.Ascii, importsOrder: ImportsOrder = ImportsOrder.Ascii,