Scala

Scala

Made by DeepSource

Consider using None instead of Some(null) SC-A1002

Anti-pattern
Minor

It is more idiomatic in scala to use Option, i.e. Some and None instead of null. Using Some(null) instead of None defeats the entire purpose of Option. However, there might be certain scenarios where this is a legitimate approach, such as when dealing with Java-based libraries, to improve compatibility.

Carefully consider whether using Option with null is necessary before doing so.

Bad practice

container.get(key) match {
  case Some(null) => // no such key
  // ...
}

Recommended

container.get(key) match {
  case None => // no such key
  // ...
}