Skip to content

Commit

Permalink
Added support for 2.11
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewfarwell committed Oct 4, 2014
1 parent c7a7705 commit 3ff8636
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 17 deletions.
19 changes: 13 additions & 6 deletions .classpath
@@ -1,16 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry including="**" kind="src" path="src/main/scala"/>
<classpathentry including="**|**/*.java" kind="src" path="src/main/scala"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/scala"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
<attributes>
Expand All @@ -28,5 +23,17 @@
<attribute name="org.eclipse.jst.component.dependency" value="../"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
3 changes: 2 additions & 1 deletion .travis.yml
@@ -1,6 +1,7 @@
language: scala
scala:
- 2.10.3
- 2.10.4
- 2.11.1
jdk:
- oraclejdk7
- openjdk7
Expand Down
9 changes: 2 additions & 7 deletions build.sbt
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/org/scalastyle/Checker.scala
Expand Up @@ -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)))
}
Expand Down Expand Up @@ -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")))
}
}

Expand Down
Expand Up @@ -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 = """<scalastyle commentFilter="enabled">
Expand Down

0 comments on commit 3ff8636

Please sign in to comment.