Scala

Scala

Made by DeepSource
Usage of wildcard imports SC-C1001
Style
Minor

It is suggested that you do not use wildcards in the import statements. This defeats the entire purpose of properly packing the code into different classes and packages. Rather, import only what you need.

Exception naming does not follow the recommended style SC-C1000
Style
Minor

Exceptions usually follow the AbcDefException nomenclature. Some examples are - NullPointerException, RuntimeException, etc. This allows the person reading/viewing the code understand that the entity being dealt with is an Exception rather than having to rely on the context.

Methods with single statement in body may follow single-line convention SC-C1006
Style
Minor

Any Scala method with a single statement in the body maybe refactored to follow the single-line convention. If the statement is more than 30 chars but less than 70, it is suggested that you move it to the next line and indent it with 2 spaces.

Too many method parameters SC-C1002
Style
Minor

This method takes too many parameters - a potential code smell/styling issue which affects the overall readability of the code. Consider using default parameter values/currying.

Parameterless method has return type - Unit SC-R1014
Style
Minor

Parameterless methods usually return a value and are part of the language. Having such methods have a return type of Unit can affect/hinder readability and defeats the purpose for which it was introduced as part of the syntax/language.

Replace !nonEmpty with isEmpty SC-R1018
Style
Minor

Standard Scala structures provide with both isEmpty and nonEmpty methods. Replacing !nonEmpty with isEmpty makes the code slightly more readable and easier to comprehend.

Empty statements block SC-C1004
Style
Minor

Empty blocks do not add anything of value to the codebase. We believe that this is either a copy-paste error or that the programmer forgot to add the relevant statements.

Method variant that return Option[T] should have their names suffixed with Option SC-C1005
Style
Minor

Option[T] is heavily used within the Scala language due to its obvious advantages. It is not uncommon to find 2 versions of the same method that differ just in the return types — T and Option[T] respectively. Some such examples are reduce, reduceOption, min, minOption, and so on.

It is therefore recommended that you follow the same styling convention — suffixing the method name with Option for the additional implementation of your method that simply differs in the return type, i.e. returns Option[T].