Skip to content

Commit

Permalink
Merge pull request #99 from eed3si9n/wip/scalafmt
Browse files Browse the repository at this point in the history
ci: Scalafmt
  • Loading branch information
eed3si9n authored Nov 8, 2024
2 parents 1a98214 + b357b28 commit 4018890
Show file tree
Hide file tree
Showing 6 changed files with 349 additions and 151 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Scalafmt

permissions: {}

on:
pull_request:
branches: ['**']

jobs:
build:
name: Code is formatted
runs-on: ubuntu-latest
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

- name: Check project is formatted
uses: jrouly/scalafmt-native-action@v4
with:
arguments: '--list'
28 changes: 28 additions & 0 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version = 3.8.3
runner.dialect = scala212
maxColumn = 120
project.git = true

# http://docs.scala-lang.org/style/scaladoc.html recommends the JavaDoc style.
# scala/scala is written that way too https://github.com/scala/scala/blob/v2.12.2/src/library/scala/Predef.scala
docstrings.style = Asterisk

# This also seems more idiomatic to include whitespace in import x.{ yyy }
spaces.inImportCurlyBraces = true

rewrite.trailingCommas.style = keep

align.tokens."+" = [
{
code = "%"
owners = [
{ regex = "Term.ApplyInfix" }
]
},
{
code = "%%"
owners = [
{ regex = "Term.ApplyInfix" }
]
}
]
71 changes: 40 additions & 31 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,51 @@ ThisBuild / version := {
"9.0.0-SNAPSHOT"
} else orig
}
lazy val root = (project in file ("."))
.enablePlugins(SbtPlugin)
.settings(
name := "flyway-sbt",
libraryDependencies ++= Seq(
"org.flywaydb" % "flyway-core" % flywayVersion
),
scalacOptions ++= Seq(
"-deprecation",
"-unchecked",
"-Xfuture"
),
pluginCrossBuild / sbtVersion := {
scalaBinaryVersion.value match {
case "2.12" => "1.5.8"
case _ => "2.0.0-M2"
}
},
Compile / doc / scalacOptions ++= {
Seq(
"-sourcepath",
(LocalRootProject / baseDirectory).value.getAbsolutePath,
"-doc-source-url",
s"""https://github.com/sbt/flyway-sbt/tree/${sys.process.Process("git rev-parse HEAD").lineStream_!.head}€{FILE_PATH}.scala"""
)
},
scriptedLaunchOpts := { scriptedLaunchOpts.value ++
lazy val root = (project in file("."))
.enablePlugins(SbtPlugin)
.settings(
name := "flyway-sbt",
libraryDependencies ++= Seq(
"org.flywaydb" % "flyway-core" % flywayVersion
),
scalacOptions ++= Seq(
"-deprecation",
"-unchecked",
"-Xfuture"
),
pluginCrossBuild / sbtVersion := {
scalaBinaryVersion.value match {
case "2.12" => "1.5.8"
case _ => "2.0.0-M2"
}
},
Compile / doc / scalacOptions ++= {
Seq(
"-sourcepath",
(LocalRootProject / baseDirectory).value.getAbsolutePath,
"-doc-source-url",
s"""https://github.com/sbt/flyway-sbt/tree/${sys.process
.Process("git rev-parse HEAD")
.lineStream_!
.head}€{FILE_PATH}.scala"""
)
},
scriptedLaunchOpts := {
scriptedLaunchOpts.value ++
Seq("-Xmx1024M", "-Dplugin.version=" + version.value)
},
scriptedBufferLog := false,
publishMavenStyle := true,
},
scriptedBufferLog := false,
publishMavenStyle := true,
)

ThisBuild / description := "An sbt plugin for Flyway database migration"
ThisBuild / developers := List(
Developer(id="davidmweber", name="David Weber", email="[email protected]", url=url("https://davidmweber.github.io/flyway-sbt-docs/"))
Developer(
id = "davidmweber",
name = "David Weber",
email = "[email protected]",
url = url("https://davidmweber.github.io/flyway-sbt-docs/")
)
)
ThisBuild / licenses := Seq("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0.txt"))
ThisBuild / scmInfo := Some(
Expand Down
1 change: 1 addition & 0 deletions project/plugin.sbt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.9.0")
addSbtPlugin("com.github.sbt" % "sbt-github-actions" % "0.24.0")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2")
Loading

0 comments on commit 4018890

Please sign in to comment.