Skip to content

Commit

Permalink
Setup a Scala project
Browse files Browse the repository at this point in the history
  • Loading branch information
mikolajkapica committed Jun 22, 2024
1 parent 9dfa6cf commit 37c59bc
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 0 deletions.
10 changes: 10 additions & 0 deletions api/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
max_line_length = 120
tab_width = 4
23 changes: 23 additions & 0 deletions api/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
### SBT template
# Simple Build Tool
# http://www.scala-sbt.org/release/docs/Getting-Started/Directories.html#configuring-version-control

dist/*
target/
lib_managed/
src_managed/
project/boot/
project/plugins/project/
.history
.cache
.lib/

### Scala template
*.class
*.log

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

.bsp/
.idea/
33 changes: 33 additions & 0 deletions api/.scalafmt.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
version = 3.8.2
runner.dialect = scala3

maxColumn = 100
align.preset = some

newlines.beforeMultiline = unfold
newlines.topLevelStatements = [before, after]
newlines.topLevelStatementsMinBreaks = 2
newlines.implicitParamListModifierForce = [before]
continuationIndent.defnSite = 2
continuationIndent.extendSite = 2
optIn.breakChainOnFirstMethodDot = true
includeCurlyBraceInSelectChains = true
includeNoParensInSelectChains = true

trailingCommas = "multiple"

rewrite.rules = [
RedundantBraces,
RedundantParens,
ExpandImportSelectors,
PreferCurlyFors
]

runner.optimizer.forceConfigStyleMinArgCount = 3
danglingParentheses.defnSite = true
danglingParentheses.callSite = true
danglingParentheses.exclude = [
"`trait`"
]
verticalMultiline.newlineAfterOpenParen = true
verticalMultiline.atDefnSite = true
9 changes: 9 additions & 0 deletions api/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ThisBuild / version := "0.1.0-SNAPSHOT"

ThisBuild / scalaVersion := "3.4.2"

lazy val root = (project in file("."))
.settings(
name := "api",
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.18" % "test"
)
1 change: 1 addition & 0 deletions api/project/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sbt.version = 1.10.0
6 changes: 6 additions & 0 deletions api/src/main/scala/App.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@main
def main(): Unit =
println("Hello world!")

def add(a: Int, b: Int): Int =
a + b
7 changes: 7 additions & 0 deletions api/src/test/scala/AppSuite.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import org.scalatest.funsuite.AnyFunSuite

class AppSuite extends AnyFunSuite {
test("Adding 2 and 2 should produce 4") {
assert(add(2, 2) == 4)
}
}

0 comments on commit 37c59bc

Please sign in to comment.