Scala

Scala

By DeepSource

Lambda parameter is unused SC-W1083
Bug risk

Lambda expressions are anonymous functions that are not bound to any particular identifier and are extensively used in the standard and 3rd party libraries for operations such as filter, map, count, etc. These expressions may take in one or more parameters just like normal methods. However, in this case, one of the parameters that the lambda depends on is unused. Either you meant to consume the said parameter or that the parameter is simply not required by design and can be omitted.

Duplicate case in pattern-matching SC-W1007
Bug risk

Duplicate cases in pattern matching are unreachable and are usually the result of human error. Because such cases are unreachable, they have the potential to affect the overall control-flow and the behaviour of the program. It is suggested that you remove such duplicate cases.

Using .deep to compare Arrays is deprecated SC-W1051
Bug risk

Comparing two Arrays using .deep is deprecated and is not supported beyond Scala version 2.12. To avoid compilation errors when moving to version 2.13 and above, consider switching to a more well supported alternative.

Type T is a potential candidate for type erasure SC-A1004
Bug risk

Usage of isInstanceOf[] and asInstanceOf[] may or may not lead to bugs depending on whether or not the type T is erased as part of type erasure during the compilation. However, the analyzer has detected that in this case, type T is a potential candidate for type erasure and there is a good chance that the entity's type is actually going to be different during the runtime.

Potential NoSuchElementException in accessing filtered elements SC-R1006
Bug risk

filter allows you to select elements from your collection based on the condition specified. However, accessing these elements directly via head or last may result in the throwing of NoSuchElementException if no elements satisfy the specified condition. Therefore, it is recommended that you use headOption and lastOption respectively to access these elements.