Scala

Scala

Made by DeepSource

Methods with single statement in body may follow single-line convention SC-C1006

Style
Minor

Any Scala method with a single statement in the body maybe refactored to follow the single-line convention. If the statement is more than 30 chars but less than 70, it is suggested that you move it to the next line and indent it with 2 spaces.

// format
def function(...): return type = expr

// gets the job done
def add(x: Int, y: Int): Int = {
  x + y
}

// preferred
def add(x: Int, y: Int): Int = x + y

// statement with more than 30 chars but less than 70
def sum(ls: List[String]): Int =
  ls.map(_.toInt).foldLeft(0)(_ + _)