Skip to content

Commit 7daf4dc

Browse files
authored
Setup project (#1)
1 parent b1a02bb commit 7daf4dc

File tree

13 files changed

+175
-0
lines changed

13 files changed

+175
-0
lines changed

.scala-steward.conf

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Reference conf file -> https://github.com/scala-steward-org/scala-steward/blob/master/docs/repo-specific-configuration.md
2+
3+
# pullRequests.frequency allows to control how often or when Scala Steward
4+
# is allowed to create pull requests.
5+
pullRequests.frequency = "1 day"
6+
7+
# If set, Scala Steward will only create or update `n` PRs each time it runs (see `pullRequests.frequency` above).
8+
# Useful if running frequently and/or CI build are costly
9+
updates.limit = 2
10+
11+
# If "always", Scala Steward will always update the PR it created as long as
12+
# you don't change it yourself.
13+
updatePullRequests = "always"
14+
15+
# If set, Scala Steward will use this message template for the commit messages and PR titles.
16+
commits.message = "Update ${artifactName} from ${currentVersion} to ${nextVersion}"

.scalafix.conf

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
rules = [
2+
RemoveUnused,
3+
NoAutoTupling,
4+
DisableSyntax,
5+
LeakingImplicitClassVal,
6+
NoValInForComprehension,
7+
ProcedureSyntax
8+
]
9+
10+
OrganizeImports {
11+
coalesceToWildcardImportThreshold = 8
12+
expandRelative = true
13+
groupedImports = Merge
14+
importSelectorsOrder = SymbolsFirst
15+
removeUnused = false
16+
groups = [
17+
"java."
18+
"*"
19+
"scala."
20+
]
21+
}

.scalafix3.conf

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
rules = [
2+
NoAutoTupling,
3+
DisableSyntax,
4+
LeakingImplicitClassVal,
5+
NoValInForComprehension
6+
]
7+
8+
OrganizeImports {
9+
coalesceToWildcardImportThreshold = 8
10+
expandRelative = true
11+
groupedImports = Merge
12+
importSelectorsOrder = SymbolsFirst
13+
removeUnused = false
14+
groups = [
15+
"java."
16+
"*"
17+
"scala."
18+
]
19+
}

.scalafmt.conf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version = 3.7.3
2+
3+
align.preset = most
4+
includeCurlyBraceInSelectChains = false
5+
maxColumn = 120
6+
newlines.sometimesBeforeColonInMethodReturnType = false
7+
project.git = true
8+
rewrite.rules = [SortImports, RedundantBraces, RedundantParens, PreferCurlyFors]
9+
runner.dialect = scala3
10+
spaces.beforeContextBoundColon = Always
11+
style = defaultWithAlign

aliases.sbt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
addCommandAlias("checkFix", "scalafixAll --check OrganizeImports; scalafixAll --check")
2+
addCommandAlias("runFix", "scalafixAll OrganizeImports; scalafixAll")
3+
addCommandAlias("checkFmt", "scalafmtCheckAll; scalafmtSbtCheck")
4+
addCommandAlias("runFmt", "scalafmtAll; scalafmtSbt")
5+
6+
addCommandAlias("ciBuild", "checkFmt; checkFix; +test")

build.sbt

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import Dependencies.*
2+
3+
lazy val scala3 = "3.2.2"
4+
lazy val scala213 = "2.13.10"
5+
lazy val supportedScalaVersions = List(scala3, scala213)
6+
lazy val scmUrl = "https://github.com/sky-uk/fs2-kafka-topic-loader"
7+
8+
ThisBuild / organization := "uk.sky"
9+
ThisBuild / description := "Read the contents of provided Kafka topics"
10+
ThisBuild / licenses := List("BSD New" -> url("https://opensource.org/licenses/BSD-3-Clause"))
11+
12+
ThisBuild / scalaVersion := scala213 // TODO - for development to get unused warnings
13+
ThisBuild / crossScalaVersions := supportedScalaVersions
14+
ThisBuild / semanticdbEnabled := true
15+
ThisBuild / semanticdbVersion := scalafixSemanticdb.revision
16+
17+
ThisBuild / scalafixDependencies += Dependencies.Plugins.organizeImports
18+
19+
tpolecatScalacOptions ++= Set(ScalacOptions.source3)
20+
21+
lazy val root = (project in file("."))
22+
.settings(
23+
name := "fs2-kafka-topic-loader",
24+
libraryDependencies ++= Seq(scalaTest)
25+
)
26+
27+
/** Scala 3 doesn't support two rules yet - RemoveUnused and ProcedureSyntax. So we require a different scalafix config
28+
* for Scala 3
29+
*
30+
* RemoveUnused relies on -warn-unused which isn't available in scala 3 yet -
31+
* https://scalacenter.github.io/scalafix/docs/rules/RemoveUnused.html
32+
*
33+
* ProcedureSyntax doesn't exist in Scala 3 - https://scalacenter.github.io/scalafix/docs/rules/ProcedureSyntax.html
34+
*/
35+
ThisBuild / scalafixConfig := {
36+
CrossVersion.partialVersion(scalaVersion.value) match {
37+
case Some((3, _)) => Some((ThisBuild / baseDirectory).value / ".scalafix3.conf")
38+
case _ => None
39+
}
40+
}
41+
42+
Test / parallelExecution := false
43+
Test / fork := true
44+
45+
Global / onChangedBuildSource := ReloadOnSourceChanges

project/Dependencies.scala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import sbt.*
2+
3+
object Dependencies {
4+
object Plugins {
5+
lazy val organizeImports = "com.github.liancheng" %% "organize-imports" % "0.6.0"
6+
}
7+
8+
lazy val scalaTest = "org.scalatest" %% "scalatest" % "3.2.15" % Test
9+
}

project/build.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
sbt.version=1.8.2

project/plugins.sbt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.0")
2+
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.10.4")
3+
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.4.1")
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package uk.sky.fs2.kafka.topicloader
2+
3+
object TopicLoader extends TopicLoader
4+
5+
trait TopicLoader {
6+
7+
def load(): Unit = ()
8+
9+
def loadAndRun(): Unit = ()
10+
11+
}

0 commit comments

Comments
 (0)