Scala

Scala

Made by DeepSource

Parameters with default values should always be specified at last SC-R1074

Anti-pattern
Major

Default values are values that are used in case the user does not explicitly supply a value. It is always recommended that you place these default values at last. Placing them at the beginning or in the middle makes it difficult to skip them when invoking the method.

Bad Practice

def m(pos: Int = -1, arr: Array[Int]): Unit = {
  // ...
}

Recommended

def m(arr: Array[Int], pos: Int = -1): Unit = {
  // ...
}