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 is parameterless inspection

Method with Unit result type defined with equals sign:
Method with Unit result type defined with equals sign inspection

Method with Unit result type defined like function:
Method with Unit result type defined like function inspection

Redundant Unit result type annotation:
Redundant Unit result type annotation inspection

Apparent refinement of result type:
Apparent refinement of result type inspection

Method name inspections

Method with accessor-like name is empty-paren:
Method with accessor-like name is empty-paren inspection

Method with accessor-like name has Unit result type:
Method with accessor-like name has Unit result type inspection

Method with mutator-like name is parameterless:
Method with mutator-like name is parameterless inspection

Method overriding inspections

Empy-paren Scala method overriden as parameterless:
Empy-paren Scala method overriden as parameterless inspection

Parameterless Scala member overriden as empty-paren:
Parameterless Scala member overriden as empty-paren inspection

Java accessor method overriden as empty-paren:
Java accessor method overriden as empty-paren inspection

Java mutator method overriden as parameterless:
Java mutator method overriden as parameterless inspection

Method access inspections

Empty-paren method accessed as parameterless:
Empty-paren method accessed as parameterless inspection

Java accessor method called as empty-paren:
Java accessor method called as empty-paren inspection

Java mutator method accessed as parameterless:
Java mutator method accessed as parameterless inspection



About Pavel Fatin

IntelliJ Scala plugin developer (http://pavelfatin.com)
This entry was posted in Uncategorized. Bookmark the permalink.

7 Responses to Signature matters!

  1. Alain O'Dea says:

    Inspections are one of my favorite features in IntelliJ and my experience with these Scala Inspections has been very positive. They go beyond what is possible in Java inspections because they talk to how you should use an API or whether or not a var is necessary. In effect these Inspections seriously help the team write idiomatic Scala code which is better for everyone :)

  2. Berta says:

    A penny saved is a penny got [earned].

  3. Leone says:

    It is appropriate time to make some plans for the future and it is time to be happy. I have read this post and if I could I desire to suggest you some interesting things or suggestions. Maybe you could write next articles referring to this article. I want to read even more things about it!

  4. Luca says:

    Sono pienamente d’accordo.

  5. Shaunna says:

    It is perfect time to make some plans for the future and it is time to be happy. I have read this post and if I could I wish to suggest you few interesting things or advice. Perhaps you can write next articles referring to this article. I wish to read more things about it!

  6. mygirlfund says:

    100% Tested and guaranteed! read more

  7. szukam zony says:

    When I originally commented I clicked the “Notify me when new comments are added” checkbox and now each time a
    comment is added I get four e-mails with
    the same comment. Is there any way you can remove people
    from that service? Thank you!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">