Skip to content

Commit

Permalink
clean: Add Scalafmt formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
josemiguelmelo committed Jan 9, 2020
1 parent 92d1649 commit 274db8e
Show file tree
Hide file tree
Showing 7 changed files with 319 additions and 244 deletions.
3 changes: 3 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ workflows:
name: publish_docker_local
cmd: |
sbt "set scalafmtUseIvy in ThisBuild := false;
scalafmt::test;
test:scalafmt::test;
sbt:scalafmt::test;
test;
set name := \"$CIRCLE_PROJECT_REPONAME\";
set version in Docker := \"latest\";
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
/target/
.idea
.DS_Store
.metals
24 changes: 24 additions & 0 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version = "1.5.1"
style = IntelliJ

align = none
assumeStandardLibraryStripMargin = false
binPack.literalArgumentLists = true
binPack.parentConstructors = false
continuationIndent.defnSite = 4
danglingParentheses = true
docstrings = ScalaDoc
includeCurlyBraceInSelectChains = true
lineEndings = unix
maxColumn = 120
newlines.alwaysBeforeTopLevelStatements = true
newlines.penalizeSingleSelectMultiArgList = false
newlines.sometimesBeforeColonInMethodReturnType = true
optIn.breakChainOnFirstMethodDot = true
project.git = true
rewrite.rules = [ SortImports, PreferCurlyFors ]
spaces.afterKeywordBeforeParen = true

project.includeFilters = [".*\\.sbt$", ".*\\.scala$"]
project.excludeFilters = [".*\\.scala.html$", "target/.*", "modules/admin/target/.*"]
onTestFailure = "To fix this, run `scalafmt` within sbt or `sbt scalafmt` on the project base directory"
29 changes: 11 additions & 18 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
import com.typesafe.sbt.packager.docker.{Cmd, ExecCmd}
import com.typesafe.sbt.packager.docker.Cmd

name := """codacy-engine-phpmd"""
name := "codacy-phpmd"

version := "1.0-SNAPSHOT"

scalaVersion := "2.13.1"

resolvers ++= Seq(
"Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/releases",
"Typesafe Repo" at "http://repo.typesafe.com/typesafe/releases/"
)

libraryDependencies ++= Seq(
"com.typesafe.play" %% "play-json" % "2.8.1" withSources(),
"org.scala-lang.modules" %% "scala-xml" % "1.2.0" withSources(),
"com.typesafe.play" %% "play-json" % "2.8.1" withSources (),
"org.scala-lang.modules" %% "scala-xml" % "1.2.0" withSources (),
"com.codacy" %% "codacy-engine-scala-seed" % "3.1.0",
"com.github.pathikrit" %% "better-files" % "3.8.0"
)
Expand All @@ -38,15 +33,13 @@ val installAll =
""".stripMargin.replaceAll(System.lineSeparator(), " ")

mappings in Universal ++= (resourceDirectory in Compile).map { resourceDir =>
val src = resourceDir / "docs"
val dest = "/docs"

val docFiles = for {
path <- src.allPaths.get if !path.isDirectory
} yield path -> path.toString.replaceFirst(src.toString, dest)
val src = resourceDir / "docs"
val dest = "/docs"

docFiles
}.value
for {
path <- src.allPaths.get if !path.isDirectory
} yield path -> path.toString.replaceFirst(src.toString, dest)
}.value

val dockerUser = "docker"
val dockerGroup = "docker"
Expand All @@ -64,7 +57,7 @@ dockerCommands := dockerCommands.value.flatMap {
cmd,
Cmd("RUN", installAll),
Cmd("RUN", "mv /opt/docker/docs /docs"),
ExecCmd("RUN", "chown", "-R", s"$dockerUser:$dockerUser", "/docs")
Cmd("RUN", s"chown -R $dockerUser:$dockerUser /docs")
)
case other => List(other)
}
3 changes: 0 additions & 3 deletions project/build.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#Activator-generated Properties
#Tue Jun 23 14:00:32 EEST 2015
#template.uuid=7faf8e1e-4e8d-4387-8159-642b50383096
sbt.version=1.3.5
Loading

0 comments on commit 274db8e

Please sign in to comment.