Skip to content

Commit

Permalink
prepare Scala 2.13.13. sort imports
Browse files Browse the repository at this point in the history
  • Loading branch information
xuwei-k committed Feb 23, 2024
1 parent 71d1f17 commit be51e87
Show file tree
Hide file tree
Showing 87 changed files with 401 additions and 167 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ jobs:
java-version: ${{ matrix.java }}
distribution: temurin
- uses: coursier/cache-action@v6
- run: sbt test
- run: sbt "rules2_13/scalafixAll --check OrganizeImports" test
- if: matrix.os != 'windows-latest'
run: sbt scalafmtSbtCheck scalafmtCheckAll
6 changes: 6 additions & 0 deletions .scalafix.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
OrganizeImports {
expandRelative = true
groupExplicitlyImportedImplicitsSeparately = false
groups = ["*"]
removeUnused = true
}
1 change: 1 addition & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
8 changes: 7 additions & 1 deletion rules/src/main/scala/fix/AddExplicitImplicitTypes.scala
Original file line number Diff line number Diff line change
@@ -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`
Expand Down
7 changes: 5 additions & 2 deletions rules/src/main/scala/fix/AddLambdaParamParentheses.scala
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down
14 changes: 8 additions & 6 deletions rules/src/main/scala/fix/CirceCodec.scala
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 3 additions & 1 deletion rules/src/main/scala/fix/CollectHead.scala
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down
4 changes: 3 additions & 1 deletion rules/src/main/scala/fix/CollectHeadOption.scala
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down
4 changes: 4 additions & 0 deletions rules/src/main/scala/fix/CompareSameValue.scala
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
15 changes: 8 additions & 7 deletions rules/src/main/scala/fix/DirectoryAndPackageName.scala
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
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
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],
Expand Down
2 changes: 1 addition & 1 deletion rules/src/main/scala/fix/DiscardSingleConfig.scala
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 3 additions & 0 deletions rules/src/main/scala/fix/DiscardValue.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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(
Expand Down
4 changes: 4 additions & 0 deletions rules/src/main/scala/fix/DuplicateWildcardImport.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
9 changes: 6 additions & 3 deletions rules/src/main/scala/fix/EitherFold.scala
Original file line number Diff line number Diff line change
@@ -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 {

Expand Down
8 changes: 5 additions & 3 deletions rules/src/main/scala/fix/EitherGetOrElse.scala
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
8 changes: 5 additions & 3 deletions rules/src/main/scala/fix/EitherMap.scala
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
7 changes: 5 additions & 2 deletions rules/src/main/scala/fix/EtaExpand.scala
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down
19 changes: 11 additions & 8 deletions rules/src/main/scala/fix/ExplicitImplicitTypes.scala
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
4 changes: 4 additions & 0 deletions rules/src/main/scala/fix/ExtendsProductWithSerializable.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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]]
Expand Down
12 changes: 7 additions & 5 deletions rules/src/main/scala/fix/FileNameConsistent.scala
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions rules/src/main/scala/fix/FilterNot.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 3 additions & 1 deletion rules/src/main/scala/fix/FilterSize.scala
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down
8 changes: 6 additions & 2 deletions rules/src/main/scala/fix/FinalObjectWarn.scala
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down
Loading

0 comments on commit be51e87

Please sign in to comment.