Signature matters! Control side effects with 15 new method signature inspections.

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.

Scala plugin 0.4.658 or later is required (download)


Method declaration syntax inspections


Method with Unit result type is parameterless:
15.png

Method with Unit result type defined with equals sign:
14.png

Method with Unit result type defined like function:
13.png

Redundant Unit result type annotation:
12.png

Apparent refinement of result type:
03.png


Method name inspections

Method with accessor-like name is empty-paren:
01.png

Method with accessor-like name has Unit result type:
02.png

Method with mutator-like name is parameterless:
10.png

Method overriding inspections

Empy-paren Scala method overriden as parameterless:
05.png

Parameterless Scala member overriden as empty-paren:
11.png

Java accessor method overriden as empty-paren:
07.png
Java mutator method overriden as parameterless:
08.png

Method access inspections


Empty-paren method accessed as parameterless:
04.png

Java accessor method called as empty-paren:
06.png

Java mutator method accessed as parameterless:
09.png

Please sign in to leave a comment.