From 3ff8636364ccc80f8488eac9e81a7c2bf97795d1 Mon Sep 17 00:00:00 2001 From: Matthew Farwell Date: Sat, 4 Oct 2014 23:28:42 +0200 Subject: [PATCH] Added support for 2.11 --- .classpath | 19 +++++++++++++------ .travis.yml | 3 ++- build.sbt | 9 ++------- src/main/scala/org/scalastyle/Checker.scala | 4 ++-- .../ScalastyleConfigurationTest.scala | 2 +- 5 files changed, 20 insertions(+), 17 deletions(-) diff --git a/.classpath b/.classpath index df3d8cfd..6024516c 100644 --- a/.classpath +++ b/.classpath @@ -1,16 +1,11 @@ - - - - - - + @@ -28,5 +23,17 @@ + + + + + + + + + + + + diff --git a/.travis.yml b/.travis.yml index de2cd359..83b98d7f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,7 @@ language: scala scala: - - 2.10.3 + - 2.10.4 + - 2.11.1 jdk: - oraclejdk7 - openjdk7 diff --git a/build.sbt b/build.sbt index 93423247..659f512d 100644 --- a/build.sbt +++ b/build.sbt @@ -14,14 +14,9 @@ crossScalaVersions := Seq("2.11.1") description := "Scalastyle style checker for Scala" -def scalariformDependency(scalaVersion: String) = scalaVersion match { - case "2.11.1" => "com.danieltrinh" %% "scalariform" % "0.1.5" - case _ => "org.scalariform" %% "scalariform" % "0.1.4" -} - -libraryDependencies <+= scalaVersion(scalariformDependency(_)) - libraryDependencies ++= Seq( + "com.danieltrinh" %% "scalariform" % "0.1.5", + "com.typesafe" % "config" % "1.2.0", "com.typesafe" % "config" % "1.2.0", "junit" % "junit" % "4.11" % "test", "com.novocode" % "junit-interface" % "0.10" % "test", diff --git a/src/main/scala/org/scalastyle/Checker.scala b/src/main/scala/org/scalastyle/Checker.scala index 1ce6036e..c374f76a 100644 --- a/src/main/scala/org/scalastyle/Checker.scala +++ b/src/main/scala/org/scalastyle/Checker.scala @@ -84,7 +84,7 @@ object Checker { }).flatten def parseScalariform(source: String): Option[ScalariformAst] = { - val tokens = ScalaLexer.tokenise(source, true, "2.10.0") + val tokens = ScalaLexer.tokenise(source, true, "2.11.0") Some(ScalariformAst(new ScalaParser(tokens.toArray).compilationUnitOrScript(), comments(tokens))) } @@ -133,7 +133,7 @@ object Checker { } verifySource(configuration, classes, file, s) } catch { - case e: Exception => List(StyleException(file: T, None, message = e.getMessage(), stacktrace = e.getStackTraceString)) + case e: Exception => List(StyleException(file: T, None, message = e.getMessage(), stacktrace = e.getStackTrace().mkString("", "\n", "\n"))) } } diff --git a/src/test/scala/org/scalastyle/ScalastyleConfigurationTest.scala b/src/test/scala/org/scalastyle/ScalastyleConfigurationTest.scala index 305da789..37c05584 100644 --- a/src/test/scala/org/scalastyle/ScalastyleConfigurationTest.scala +++ b/src/test/scala/org/scalastyle/ScalastyleConfigurationTest.scala @@ -41,7 +41,7 @@ class ScalastyleConfigurationTest extends AssertionsForJUnit { assertEquals(clean(contents), clean(ScalastyleConfiguration.toXmlString(config, width, step))) } - def clean(s: String): String = s.replace("\015", "") + def clean(s: String): String = s.replace("\u000d", "") @Test def readXmlStringWithCustom(): Unit = { val xml = """