スタイルガイドを整備しても “any style guide written in English is either so brief that it’s ambiguous, or so long that no one reads it.” Bob Nystrom The Hardest Program I've Ever Written http://journal.stuffwithstuff.com/2015/09/08/the-hardest-program-ive-ever-written/
Code Formatter!! “Spend more time discussing important issues in code review and less time on code style. Scalafmt formats code so that it looks consistent between people on your team.” scalafmt.org
maxColumn (default: 80) // before class ExtendTest extends A with B with C with D // after (maxCoulumn=20) class ExtendTest extends A with B with C with D ※必ず指定した値以内に収まるわけではないことに注意
continuationIndent.extendSite (default: 4) // before class UserProfile extends Profile with SomeTrait // after class UserProfile extends Profile with SomeTrait
align = none // before x match { case "foo" => 1 // comment case "hoge" => 123 // comment case "foobar" => 12345 // comment } // after x match { case "foo" => 1 // comment case "hoge" => 123 // comment case "foobar" => 12345 // comment }
align = some (default) // before x match { case "foo" => 1 // comment case "hoge" => 123 // comment case "foobar" => 12345 // comment } // after (case match の => のみ align する) x match { case "foo" => 1 // comment case "hoge" => 123 // comment case "foobar" => 12345 // comment }
RewriteRules - RedundantBraces // before val x: Int => String = { case 2 => { "two" } case _ => { "other" } } // after val x: Int => String = { case 2 => "two" case _ => "other" }
RewriteRules - SortModifiers // before final lazy private implicit val x = 42 lazy final implicit private val y = 42 // after implicit final private lazy val x = 42 implicit final private lazy val y = 42 sortModifiers.order = [“implicit”, “final” … ] で順番の設定も可能