Scala

Scala

By DeepSource

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

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.

Consider grouping imports from same package together SC-R1011
Anti-pattern

Scala allows you to import entities from same package in separate statements. However, it is generally recommended that you group such imports together. Doing so makes the code more readable and easier to navigate.

final modifier is redundant for object SC-R1053
Anti-pattern

A class cannot extend an object thereby making the final modifier redundant. It is therefore recommended that you drop the said modifier.

Consider explicitly defining the main method, i.e. the entry point SC-W1062
Anti-pattern

Scala allows you to inherit from scala.App (which uses DelayedInit) to set up a simple and small Main program. However, since DelayedInit is now deprecated, it is recommended that you define a suitable entry point of your own.

Pattern matching only mentions wildcard patterns SC-R1066
Anti-pattern

Classes that are either case or that implement the unapply() method allow you to utilize pattern matching. However, in this case, all the patterns specified in the pattern matching are wildcard patterns. Either this is a mistake or you meant to simply match a specific type. In the latter's case, consider using the syntax v: Tpe.