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
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=3.0.0
version=3.0.1
style = defaultWithAlign
maxColumn = 100

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ case class Compiler() {

contribs.unsafeRunSync().result match {
case Right(result) =>
result.collect({
result.collect {
case Commit(sha, message, date, url, Some(login), Some(avatar_url), Some(author_url)) =>
ContributionInfo(
sha = sha,
Expand All @@ -181,7 +181,7 @@ case class Compiler() {
avatarUrl = avatar_url,
authorUrl = author_url
)
})
}
case Left(ex) => throw ex
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ class SourceTextExtraction {
absolutePath.split(base).lift(1).getOrElse("")

def extractAll(sources: List[String], paths: List[String], baseDir: String): Extracted = {
new global.Run() compileSources (paths zip sources).map({ case (path, code) =>
new global.Run() compileSources (paths zip sources).map { case (path, code) =>
new BatchSourceFile(path, code)
})
}
val run = global.currentRun
val symbolPaths = Map(run.symSource.toList: _*).map({ case (symbol, file) =>
val symbolPaths = Map(run.symSource.toList: _*).map { case (symbol, file) =>
(symbol.toString, relativePath(file.path, baseDir))
})
}
val compilationUnits = run.units.toList // `units` is only only iterable once!
val extractions = compilationUnits.map(_.body).map(boundExtractRaw)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,18 +126,18 @@ object ExerciseCompilerPlugin extends AutoPlugin {
* `exercise.Library`.
*/
private def discoverLibraries(analysis: CompileAnalysis): Seq[String] =
Discovery(Set("org.scalaexercises.definitions.Library"), Set.empty)(Tests.allDefs(analysis))
.collect({
case (definition, discovered) if !discovered.isEmpty => definition.name
})
.sorted
Discovery(Set("org.scalaexercises.definitions.Library"), Set.empty)(
Tests.allDefs(analysis)
).collect {
case (definition, discovered) if !discovered.isEmpty => definition.name
}.sorted

private def discoverSections(analysis: CompileAnalysis): Seq[String] =
Discovery(Set("org.scalaexercises.definitions.Section"), Set.empty)(Tests.allDefs(analysis))
.collect({
case (definition, discovered) if !discovered.isEmpty => definition.name
})
.sorted
Discovery(Set("org.scalaexercises.definitions.Section"), Set.empty)(
Tests.allDefs(analysis)
).collect {
case (definition, discovered) if !discovered.isEmpty => definition.name
}.sorted

// reflection is used to invoke a java-style interface to the exercise compiler
private val COMPILER_CLASS = "org.scalaexercises.compiler.CompilerJava"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ object Check extends App {
assert(errors.isEmpty, "expected errors to be empty")
assert(libraries.length == 1, "expected one library from the content project")


val res = libraries.find(_.name == "sample")
val res = libraries
.find(_.name == "sample")
.flatMap(_.sections.find(_.name == "foo"))
.flatMap(_.exercises.find(_.name == "foo1"))

assert(res.isDefined, "evaluation of exercise method failed")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ package stdlib

import org.scalaexercises.definitions.Section

/** This is a Section
*
* @param name Section Bar
*/
/**
* This is a Section
*
* @param name
* Section Bar
*/
object BarSection extends Section {

/** Exercise bar 1 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ package stdlib

import org.scalaexercises.definitions.Section

/** This is a Section Foo
*
* @param name foo
*/
/**
* This is a Section Foo
*
* @param name
* foo
*/
object FooSection extends Section {

/** Exercise foo 1 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ package stdlib

import org.scalaexercises.definitions.Library

/** This is my Library
* @param name sample
*/
/**
* This is my Library
* @param name
* sample
*/
object SampleLibrary extends Library {

override def owner = "scala-exercises"
override def owner = "scala-exercises"
override def repository = "scala-exercises"

override def color = Option("#BADA55")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ package org.my.nested.pack

import org.scalaexercises.definitions.Section

/** This is a Section within package package org.my.nested.pack
*
* @param name Section Bar
*/
/**
* This is a Section within package package org.my.nested.pack
*
* @param name
* Section Bar
*/
object BarSection extends Section {

/** Exercise bar 1 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ package org.my.nested.pack

import org.scalaexercises.definitions.Section

/** This is a Section Foo in package org.my.nested.pack
*
* @param name foo
*/
/**
* This is a Section Foo in package org.my.nested.pack
*
* @param name
* foo
*/
object FooSection extends Section {

/** Exercise foo 1 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ package org.my.nested.pack

import org.scalaexercises.definitions.Library

/** This is my Library in package org.my.nested.pack
* @param name sample
*/
/**
* This is my Library in package org.my.nested.pack
* @param name
* sample
*/
object MyLibrary extends Library {

override def owner = "scala-exercises"
override def owner = "scala-exercises"
override def repository = "scala-exercises"

override def color = Option("#476047")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ resolvers ++= Seq(
{
val pluginVersion = System.getProperty("plugin.version")
if (pluginVersion == null)
throw new RuntimeException("""|The system property 'plugin.version' is not defined.
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin)
throw new RuntimeException(
"""|The system property 'plugin.version' is not defined.
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin
)
else addSbtPlugin("org.scala-exercises" % "sbt-exercise" % pluginVersion)
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ resolvers ++= Seq(
{
val pluginVersion = System.getProperty("plugin.version")
if (pluginVersion == null)
throw new RuntimeException("""|The system property 'plugin.version' is not defined.
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin)
throw new RuntimeException(
"""|The system property 'plugin.version' is not defined.
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin
)
else addSbtPlugin("org.scala-exercises" % "sbt-exercise" % pluginVersion)
}
addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.8.3")
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
//

object PoorlyFormatted extends App {
println("it's " + { 1 + {
// this file
// is poorly
println("it's " + {
1 + {
// this file
// is poorly
// formatted

Option(1)
.map(_ + 1)
.map(_ * 10)
.map(_ /
11) getOrElse 100
}
.map(_ + 1)
.map(_ * 10)
.map(
_ /
11
) getOrElse 100
}

} ) }
})
}