Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version = 3.0.4
maxColumn = 110
docstrings.style = Asterisk
newlines.alwaysBeforeMultilineDef = false
newlines.penalizeSingleSelectMultiArgList = false
align.openParenCallSite = false
rewrite.rules = [AvoidInfix, SortImports, RedundantBraces, RedundantParens, PreferCurlyFors]
rewrite.redundantBraces.generalExpressions = false
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ addons:

matrix:
include:
# - scala: 2.11.12
# env: BUILD="check code formatting"
# script:
# - ./sbt ++$TRAVIS_SCALA_VERSION clean scalafmtSbtCheck scalafmtCheckAll

#BASE TESTS
- scala: 2.11.12
env: BUILD="base" TEST_TARGET="scalding-args scalding-date maple scalding-quotation"
Expand Down
16 changes: 2 additions & 14 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import ReleaseTransformations._
import com.typesafe.sbt.SbtScalariform.scalariformSettings
import com.typesafe.sbt.SbtScalariform.ScalariformKeys
import com.typesafe.tools.mima.plugin.MimaPlugin.mimaDefaultSettings
import scala.collection.JavaConverters._
import scalariform.formatter.preferences._
import microsites.ExtraMdFileConfig

def scalaBinaryVersion(scalaVersion: String) = scalaVersion match {
Expand Down Expand Up @@ -43,15 +40,13 @@ val jlineVersion = "2.14.3"

val printDependencyClasspath = taskKey[Unit]("Prints location of the dependencies")

val sharedSettings = scalariformSettings ++ Seq(
val sharedSettings = Seq(
organization := "com.twitter",

scalaVersion := "2.11.12",

crossScalaVersions := Seq(scalaVersion.value, "2.12.14"),

ScalariformKeys.preferences := formattingPreferences,

javacOptions ++= Seq("-source", "1.8", "-target", "1.8"),

doc / javacOptions := Seq("-source", "1.8"),
Expand Down Expand Up @@ -87,7 +82,7 @@ val sharedSettings = scalariformSettings ++ Seq(

update / aggregate := false,

Test / javaOptions ++= Seq("-Xmx2048m", "-XX:ReservedCodeCacheSize=384m", "-XX:MaxPermSize=384m"),
Test / javaOptions ++= Seq("-Xmx2048m", "-XX:ReservedCodeCacheSize=384m"),

Global / concurrentRestrictions := Seq(
Tags.limitAll(1)
Expand Down Expand Up @@ -251,13 +246,6 @@ lazy val scaldingAssembly = Project(
scaldingSerialization
)

lazy val formattingPreferences = {
import scalariform.formatter.preferences._
FormattingPreferences().
setPreference(AlignParameters, false).
setPreference(PreserveSpaceBeforeArguments, true)
}

lazy val noPublishSettings = Seq(
publish := (()),
publishLocal := (()),
Expand Down
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ addSbtPlugin("com.twitter" %% "scrooge-sbt-plugin" % "18.9.0")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.1.14")
addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3")
addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.0")
addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.8.3")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.3")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.8.2")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.7")
addSbtPlugin("org.wartremover" % "sbt-wartremover" % "2.4.16")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -651,8 +651,8 @@ class PlatformTest extends WordSpec with Matchers with HadoopSharedPlatformTest
"reduce stage - sum",
"write",
// should see the .group and the .write show up as line numbers
"com.twitter.scalding.platform.TypedPipeWithDescriptionJob.<init>(TestJobsWithDescriptions.scala:30)",
"com.twitter.scalding.platform.TypedPipeWithDescriptionJob.<init>(TestJobsWithDescriptions.scala:34)")
"com.twitter.scalding.platform.TypedPipeWithDescriptionJob.<init>(TestJobsWithDescriptions.scala:31)",
"com.twitter.scalding.platform.TypedPipeWithDescriptionJob.<init>(TestJobsWithDescriptions.scala:35)")

val foundDescs = steps.map(_.getConfig.get(Config.StepDescriptions))
descs.foreach { d =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ class TypedPipeJoinWithDescriptionJob(args: Args) extends Job(args) {
}

class TypedPipeWithDescriptionJob(args: Args) extends Job(args) {
TypedPipe.from[String](List("word1", "word1", "word2"))
TypedPipe
.from[String](List("word1", "word1", "word2"))
.withDescription("map stage - assign words to 1")
.map { w => (w, 1L) }
.map(w => (w, 1L))
.group
.withDescription("reduce stage - sum")
.sum
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,17 @@ class TextMacroTest extends Test {
}
}
"with function" in {
(test.paramGroupsWithFunction(1) {
case 1 => 2
case _ => 3
})._1.text mustEqual
test
.paramGroupsWithFunction(1) {
case 1 => 2
case _ => 3
}
._1
.text mustEqual
Some("""paramGroupsWithFunction(1) {
case 1 => 2
case _ => 3
}""")
case 1 => 2
case _ => 3
}""")
}
}

Expand All @@ -85,7 +88,7 @@ class TextMacroTest extends Test {
test.function { case _ => 4 }._1.text mustEqual Some("function { case _ => 4 }")
}
"curly braces" in {
test.function { _ + 1 }._1.text mustEqual Some("function { _ + 1 }")
test.function(_ + 1)._1.text mustEqual Some("function(_ + 1)")
}
}

Expand All @@ -95,8 +98,7 @@ class TextMacroTest extends Test {
_ + 1
}
c._1.text mustEqual
Some(
"""function {
Some("""function {
def test = 1
_ + 1
}""")
Expand All @@ -106,4 +108,4 @@ class TextMacroTest extends Test {
test.tupleParam((1, 2))._1.text mustEqual
Some("tupleParam((1, 2))")
}
}
}