Scala

Scala

Made by DeepSource

Redundant val keyword for case class' constructor parameter SC-R1038

Bug risk
Minor

By default, case class' parameters are accessible from both outside and inside the class. Therefore, marking them with the val keyword is no longer necessary and is redundant.

Bad practice

case class Person(val name: String)

val p = Person("mark")
p.name

// Output
// mark

Recommended

case class Person(name: String)

val p = Person("mark")

// Output
// mark