Signature matters!
In Scala, method signature semantics goes beyond method name, parameters and result type. The signature can also tell about whether a method has side effects, or whether a method represents a property.
However, sometimes we forget about writing proper definitions or method calls. That’s where 15 new method signature inspections may help.
Method declaration syntax inspections
Method with Unit result type is parameterless:
Method with Unit result type defined with equals sign:
Method with Unit result type defined like function:
Redundant Unit result type annotation:
Apparent refinement of result type:
Method name inspections
Method with accessor-like name is empty-paren:
Method with accessor-like name has Unit result type:
Method with mutator-like name is parameterless:
Method overriding inspections
Empy-paren Scala method overriden as parameterless:
Parameterless Scala member overriden as empty-paren:
Java accessor method overriden as empty-paren:
Java mutator method overriden as parameterless:
Method access inspections
Empty-paren method accessed as parameterless:
Java accessor method called as empty-paren:
Java mutator method accessed as parameterless: