Skip to content

Commit

Permalink
Update scalafmt settings. enforce new syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
xuwei-k committed Nov 11, 2024
1 parent 12efd61 commit d628e8c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
6 changes: 5 additions & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version = 3.8.3
runner.dialect = scala212
runner.dialect = scala212source3
maxColumn = 120
project.git = true

Expand Down Expand Up @@ -28,3 +28,7 @@ align.tokens."+" = [
]

project.layout = StandardConvention
rewrite.scala3.convertToNewSyntax = true
rewrite.scala3.newSyntax.control = false
runner.dialectOverride.allowUnderscoreAsTypePlaceholder = false
runner.dialectOverride.allowSignificantIndentation = false
2 changes: 1 addition & 1 deletion src/main/scala-2.12/PluginCompat.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package flywaysbt

import java.nio.file.{ Path => NioPath }
import java.nio.file.{ Path as NioPath }
import java.io.File
import sbt.Attributed
import xsbti.FileConverter
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala-3/PluginCompat.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package flywaysbt

import java.nio.file.{ Path => NioPath }
import java.nio.file.{ Path as NioPath }
import sbt.*
import xsbti.{ FileConverter, HashedVirtualFileRef, VirtualFile }

Expand Down
24 changes: 12 additions & 12 deletions src/main/scala/flywaysbt/FlywayPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,13 @@ object FlywayPlugin extends AutoPlugin {
// *********************
// flyway defaults
// *********************
override def projectSettings: Seq[Setting[_]] =
override def projectSettings: Seq[Setting[?]] =
flywayBaseSettings(Runtime) ++ inConfig(Test)(flywayBaseSettings(Test))

def flywayBaseSettings(conf: Configuration): Seq[Setting[_]] = {
import FlywayPlugin.autoImport._
def flywayBaseSettings(conf: Configuration): Seq[Setting[?]] = {
import FlywayPlugin.autoImport.*
val defaults = getFlywayDefaults
Seq[Setting[_]](
Seq[Setting[?]](
flywayDriver := "",
flywayUrl := "",
flywayUser := "",
Expand Down Expand Up @@ -302,7 +302,7 @@ object FlywayPlugin extends AutoPlugin {
flywaySqlMigrationPrefix.value,
flywayRepeatableSqlMigrationPrefix.value,
flywaySqlMigrationSeparator.value,
flywaySqlMigrationSuffixes.value: _*
flywaySqlMigrationSuffixes.value*
),
flywayConfigMigrate := ConfigMigrate(
flywayIgnoreMissingMigrations.value,
Expand Down Expand Up @@ -406,22 +406,22 @@ object FlywayPlugin extends AutoPlugin {
}
def configure(config: ConfigBase): FluentConfiguration = {
flyway
.schemas(config.schemas: _*)
.schemas(config.schemas*)
.table(config.table)
.baselineVersion(config.baselineVersion)
.baselineDescription(config.baselineDescription)

}
def configure(config: ConfigMigrationLoading): FluentConfiguration = {
flyway
.locations(config.locations: _*)
.locations(config.locations*)
.encoding(config.encoding)
.cleanOnValidationError(config.cleanOnValidationError)
.cleanDisabled(config.cleanDisabled)
// .target(config.target) Setting this as-is will make the default be "current", which we don't want
.outOfOrder(config.outOfOrder)
.callbacks(config.callbacks: _*)
.resolvers(config.resolvers: _*)
.callbacks(config.callbacks*)
.resolvers(config.resolvers*)
.skipDefaultResolvers(config.skipDefaultResolvers)
.skipDefaultCallbacks(config.skipDefaultCallbacks)
.validateMigrationNaming(config.validateMigrationNaming)
Expand All @@ -431,12 +431,12 @@ object FlywayPlugin extends AutoPlugin {
.sqlMigrationPrefix(config.sqlMigrationPrefix)
.repeatableSqlMigrationPrefix(config.repeatableSqlMigrationPrefix)
.sqlMigrationSeparator(config.sqlMigrationSeparator)
.sqlMigrationSuffixes(config.sqlMigrationSuffixes: _*)
.sqlMigrationSuffixes(config.sqlMigrationSuffixes*)
}
def configure(config: ConfigMigrate): FluentConfiguration = {

flyway
.ignoreMigrationPatterns(config.ignorePatterns: _*)
.ignoreMigrationPatterns(config.ignorePatterns*)
.baselineOnMigrate(config.baselineOnMigrate)
.validateOnMigrate(config.validateOnMigrate)
.mixed(config.mixed)
Expand All @@ -459,7 +459,7 @@ object FlywayPlugin extends AutoPlugin {
}

private object SbtLogCreator extends LogCreator {
def createLogger(clazz: Class[_]): FlywaySbtLog.type = FlywaySbtLog
def createLogger(clazz: Class[?]): FlywaySbtLog.type = FlywaySbtLog
}

private object FlywaySbtLog extends Log {
Expand Down

0 comments on commit d628e8c

Please sign in to comment.