Skip to content

Commit

Permalink
Merge pull request #104 from xuwei-k/update-scalafmt
Browse files Browse the repository at this point in the history
Update scalafmt settings. enforce new syntax
  • Loading branch information
eed3si9n authored Nov 11, 2024
2 parents 12efd61 + ad5a6d4 commit 935e9dd
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 18 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ jobs:
fetch-depth: 0
persist-credentials: false

- name: Check project is formatted
uses: jrouly/scalafmt-native-action@v4
- uses: actions/setup-java@v4
with:
arguments: '--list'
distribution: temurin
java-version: 8

- uses: sbt/setup-sbt@v1

- name: Check project is formatted
run: sbt scalafmtSbtCheck "+ scalafmtCheckAll"
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 935e9dd

Please sign in to comment.