diff --git a/.travis.yml b/.travis.yml
index 110cae400226..c8061b4f8168 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,6 +1,6 @@
language: scala
script:
- - sbt -Ddotty.travis.build=yes update compile test
+ - sbt -Ddotty.travis.build=yes update compile test scalastyle
jdk:
- oraclejdk8
notifications:
diff --git a/project/Build.scala b/project/Build.scala
index 8bba50e4a9f8..e5c4a0699e3d 100644
--- a/project/Build.scala
+++ b/project/Build.scala
@@ -27,7 +27,7 @@ object DottyBuild extends Build {
// to get Scala 2.11
resolvers += Resolver.sonatypeRepo("releases"),
-
+
// get reflect and xml onboard
libraryDependencies ++= Seq("org.scala-lang" % "scala-reflect" % scalaVersion.value,
"org.scala-lang.modules" %% "scala-xml" % "1.0.1",
@@ -59,7 +59,7 @@ object DottyBuild extends Build {
val path = for {
file <- attList.map(_.data)
path = file.getAbsolutePath
- } yield "-Xbootclasspath/p:" + path
+ } yield "-Xbootclasspath/p:" + path
// dotty itself needs to be in the bootclasspath
val fullpath = ("-Xbootclasspath/a:" + bin) :: path.toList
// System.err.println("BOOTPATH: " + fullpath)
@@ -109,8 +109,8 @@ object DottyBuild extends Build {
val path = for {
file <- attList.map(_.data)
path = file.getAbsolutePath
- prefix = if(path.endsWith(".jar")) "p" else "a"
- } yield "-Xbootclasspath/"+ prefix +":" + path
+ prefix = if (path.endsWith(".jar")) "p" else "a"
+ } yield "-Xbootclasspath/" + prefix + ":" + path
// dotty itself needs to be in the bootclasspath
val fullpath = ("-Xbootclasspath/a:" + bin) :: path.toList
// System.err.println("BOOTPATH: " + fullpath)
@@ -121,7 +121,7 @@ object DottyBuild extends Build {
else
List()
val res = agentOptions ::: travis_build ::: fullpath
- println("Running with javaOptions: " +res)
+ println("Running with javaOptions: " + res)
res
}
)
diff --git a/project/plugins.sbt b/project/plugins.sbt
index 654570000877..47bc44dfe35e 100644
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -4,3 +4,6 @@
// Scala IDE project file generator
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.2.0")
+
+addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "0.6.0")
+
diff --git a/scalastyle-config.xml b/scalastyle-config.xml
new file mode 100644
index 000000000000..2b2f8c8f24fc
--- /dev/null
+++ b/scalastyle-config.xml
@@ -0,0 +1,122 @@
+
+ Scalastyle standard configuration
+
+
+
+
+
+
+
+
+
+ IF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/dotty/DottyPredef.scala b/src/dotty/DottyPredef.scala
index 3ffa4049f175..b4580b6a3609 100644
--- a/src/dotty/DottyPredef.scala
+++ b/src/dotty/DottyPredef.scala
@@ -7,4 +7,4 @@ object DottyPredef {
/** implicits for ClassTag and TypeTag. Should be implemented with macros */
implicit def classTag[T]: ClassTag[T] = ???
implicit def typeTag[T]: TypeTag[T] = ???
-}
\ No newline at end of file
+}
diff --git a/src/dotty/Pair.scala b/src/dotty/Pair.scala
index 73696b69c0d6..2322fe1690c7 100644
--- a/src/dotty/Pair.scala
+++ b/src/dotty/Pair.scala
@@ -2,4 +2,4 @@ package dotty
class Pair[T, U](x: T, y: U) {
-}
\ No newline at end of file
+}
diff --git a/src/dotty/Singleton.scala b/src/dotty/Singleton.scala
index 06f975b01fc1..4ba57a12de2c 100644
--- a/src/dotty/Singleton.scala
+++ b/src/dotty/Singleton.scala
@@ -2,4 +2,4 @@ package dotty
class Singleton {
-}
\ No newline at end of file
+}
diff --git a/src/dotty/annotation/internal/Alias.scala b/src/dotty/annotation/internal/Alias.scala
index 44695c7dd9cd..de51153f1ab4 100644
--- a/src/dotty/annotation/internal/Alias.scala
+++ b/src/dotty/annotation/internal/Alias.scala
@@ -4,4 +4,4 @@ import scala.annotation.Annotation
class Alias(aliased: Any) extends Annotation {
-}
\ No newline at end of file
+}
diff --git a/src/dotty/annotation/internal/AnnotationDefault.scala b/src/dotty/annotation/internal/AnnotationDefault.scala
index 1405c94bd20c..90471b8fec38 100644
--- a/src/dotty/annotation/internal/AnnotationDefault.scala
+++ b/src/dotty/annotation/internal/AnnotationDefault.scala
@@ -4,4 +4,4 @@ import scala.annotation.Annotation
class AnnotationDefault extends Annotation {
-}
\ No newline at end of file
+}
diff --git a/src/dotty/annotation/internal/Child.scala b/src/dotty/annotation/internal/Child.scala
index 9c2f83d7b247..ac253ed8d07f 100644
--- a/src/dotty/annotation/internal/Child.scala
+++ b/src/dotty/annotation/internal/Child.scala
@@ -4,4 +4,4 @@ import scala.annotation.Annotation
class Child[T] extends Annotation {
-}
\ No newline at end of file
+}
diff --git a/src/dotty/annotation/internal/Repeated.scala b/src/dotty/annotation/internal/Repeated.scala
index 94e9df858d1f..3065b7a06567 100644
--- a/src/dotty/annotation/internal/Repeated.scala
+++ b/src/dotty/annotation/internal/Repeated.scala
@@ -2,4 +2,4 @@ package dotty.annotation.internal
import scala.annotation.Annotation
-final class Repeated() extends Annotation
\ No newline at end of file
+final class Repeated() extends Annotation
diff --git a/src/dotty/language.scala b/src/dotty/language.scala
index 169b2604c97e..96250a9f29b5 100644
--- a/src/dotty/language.scala
+++ b/src/dotty/language.scala
@@ -13,4 +13,4 @@ object language {
/** No auto tupling */
val noAutoTupling = new Feature
-}
\ No newline at end of file
+}
diff --git a/src/dotty/runtime/Arrays.scala b/src/dotty/runtime/Arrays.scala
index 5767991e59f8..1fb4fe5ebc69 100644
--- a/src/dotty/runtime/Arrays.scala
+++ b/src/dotty/runtime/Arrays.scala
@@ -12,14 +12,14 @@ object Arrays {
*/
def newGenericArray[T](length: Int)(implicit tag: ClassTag[T]): Array[T] =
tag.newArray(length)
-
+
/** Convert a sequence to a Java array with element type given by `clazz`. */
def seqToArray[T](xs: Seq[T], clazz: Class[_]): Array[T] = {
val arr = java.lang.reflect.Array.newInstance(clazz, xs.length).asInstanceOf[Array[T]]
xs.copyToArray(arr)
arr
}
-
+
/** Create an array of type T. T must be of form Array[E], with
* E being a reference type.
*/
@@ -51,4 +51,4 @@ object Arrays {
/** Create a scala.runtime.BoxedUnit[] array */
def newUnitArray(length: Int): Array[Unit] = ???
-}
\ No newline at end of file
+}
diff --git a/src/dotty/tools/backend/jvm/CollectEntryPoints.scala b/src/dotty/tools/backend/jvm/CollectEntryPoints.scala
index 734890daa2e1..513144bd6b3b 100644
--- a/src/dotty/tools/backend/jvm/CollectEntryPoints.scala
+++ b/src/dotty/tools/backend/jvm/CollectEntryPoints.scala
@@ -40,7 +40,7 @@ class CollectEntryPoints extends MiniPhaseTransform {
def phaseName: String = "Collect entry points"
override def transformDefDef(tree: tpd.DefDef)(implicit ctx: Context, info: TransformerInfo): tpd.Tree = {
- if((tree.symbol ne NoSymbol) && CollectEntryPoints.isJavaEntyPoint(tree.symbol)) {
+ if ((tree.symbol ne NoSymbol) && CollectEntryPoints.isJavaEntyPoint(tree.symbol)) {
ctx.genBCodePhase.asInstanceOf[GenBCode].registerEntryPoint(tree.symbol)
}
tree
diff --git a/src/dotty/tools/backend/jvm/DottyBackendInterface.scala b/src/dotty/tools/backend/jvm/DottyBackendInterface.scala
index 8cc3c34e5bde..e9c8dbc80362 100644
--- a/src/dotty/tools/backend/jvm/DottyBackendInterface.scala
+++ b/src/dotty/tools/backend/jvm/DottyBackendInterface.scala
@@ -376,7 +376,7 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{
def shouldEmitJumpAfterLabels = true
def dumpClasses: Option[String] =
- if(ctx.settings.Ydumpclasses.isDefault) None
+ if (ctx.settings.Ydumpclasses.isDefault) None
else Some(ctx.settings.Ydumpclasses.value)
def mainClass: Option[String] =
@@ -423,7 +423,7 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{
case TermRef(prefix: ThisType, name) =>
Some(tpd.This(prefix.cls).select(i.symbol))
case TermRef(NoPrefix, name) =>
- if(i.symbol is Flags.Method) Some(This(i.symbol.enclosingClass).select(i.symbol)) // workaround #342 todo: remove after fixed
+ if (i.symbol is Flags.Method) Some(This(i.symbol.enclosingClass).select(i.symbol)) // workaround #342 todo: remove after fixed
else None
case _ => None
}
@@ -663,7 +663,7 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{
def companionSymbol: Symbol = if (sym is Flags.Module) companionClass else companionModule
def moduleClass: Symbol = toDenot(sym).moduleClass
def enclosingClassSym: Symbol = {
- if(this.isClass) {
+ if (this.isClass) {
val ct = ctx.withPhase(ctx.flattenPhase.prev)
toDenot(sym)(ct).owner.enclosingClass(ct)
}
@@ -792,7 +792,7 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{
t.info match {
case _ =>
- if(!t.symbol.isClass) nonClassTypeRefToBType(t.symbol) // See comment on nonClassTypeRefToBType
+ if (!t.symbol.isClass) nonClassTypeRefToBType(t.symbol) // See comment on nonClassTypeRefToBType
else primitiveOrClassToBType(t.symbol) // Common reference to a type such as scala.Int or java.lang.String
}
case Types.ClassInfo(_, sym, _, _, _) => primitiveOrClassToBType(sym) // We get here, for example, for genLoadModule, which invokes toTypeKind(moduleClassSymbol.info)
@@ -942,7 +942,7 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{
def _3: Tree = field.rhs
override def unapply(s: LabelDef): DottyBackendInterface.this.LabelDef.type = {
- if(s.symbol is Flags.Label) this.field = s
+ if (s.symbol is Flags.Label) this.field = s
else this.field = null
this
}
@@ -1021,16 +1021,16 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{
def _2 = field.meth
def _3 = {
val t = field.tpt.tpe.typeSymbol
- if(t.exists) t
+ if (t.exists) t
else {
val arity = field.meth.tpe.widenDealias.paramTypes.size - _1.size
val returnsUnit = field.meth.tpe.widenDealias.resultType.classSymbol == UnitClass
- if(returnsUnit)
- ctx.requiredClass(("scala.compat.java8.JProcedure"+arity).toTermName)
- else ctx.requiredClass(("scala.compat.java8.JFunction"+arity).toTermName)
+ if (returnsUnit)
+ ctx.requiredClass(("scala.compat.java8.JProcedure" + arity).toTermName)
+ else ctx.requiredClass(("scala.compat.java8.JFunction" + arity).toTermName)
}
}
}
def currentUnit = ctx.compilationUnit
-}
\ No newline at end of file
+}
diff --git a/src/dotty/tools/backend/jvm/LabelDefs.scala b/src/dotty/tools/backend/jvm/LabelDefs.scala
index 769dcdc36673..8f9e3bdcca2f 100644
--- a/src/dotty/tools/backend/jvm/LabelDefs.scala
+++ b/src/dotty/tools/backend/jvm/LabelDefs.scala
@@ -44,7 +44,7 @@ import StdNames.nme
*
*