Created
March 10, 2017 14:08
-
-
Save alexarchambault/822a8e04026fafde5d8d3b849c30fbcb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
curl -L -o coursier https://github.com/alexarchambault/coursier/raw/v1.0.0-M15-1/coursier | |
chmod +x coursier | |
./coursier bootstrap com.geirsson:scalafmt-cli_2.11:0.6.2 --main org.scalafmt.cli.Cli -o scalafmt | |
cat > Foo.scala << EOF | |
import scala.annotation.tailrec | |
object Foo { | |
def sum(from: Int, until: Int) = { | |
@tailrec | |
def helper(from: Int, acc: Int): Int = | |
if (from >= until) | |
acc | |
else | |
helper(from + 1, acc + from) | |
helper(from, until, 0) | |
} | |
} | |
EOF | |
cat > .scalafmt.conf << EOF | |
newlines.alwaysBeforeTopLevelStatements = true | |
EOF | |
# Adds a new line between @tailrec and def helper(...) | |
./scalafmt -i -f . | |
# Typically getting | |
# .../Foo.scala:9: expected start of definition | |
# def helper(from: Int, acc: Int): Int = | |
# ^ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment