Stephen
Stephen

Reputation: 4296

how to turn off IntelliJ warning for scala "method with accessor like name is empty-paren"

How do I turn off this warning? I like most of the Intellij warnings but not this one.

method with accessor like name is empty-paren

accessor-like-name

Upvotes: 2

Views: 4614

Answers (3)

twick
twick

Reputation: 1

Intellij inspections seem to assume that any method starting with get, is, or to are accessors and any method starting with set or update are mutators. If you don't want to outright disable the inspection, you can just avoid using these specific verbs.

Otherwise, see Micho's answer to disable it.

Note: I would add this as a comment on the existing chosen answer but I don't yet have the karma for that.

Upvotes: 0

Java Devil
Java Devil

Reputation: 10959

Multiple options: (first is in general for any Intellij setting and will save you so much time)

    • Do a search everywhere (default shortcuts)
      • Windows/Linux: Double press Shift
      • Mac: Double press
    • Ensure you have IDE settings enabled: (Click cog and click On as needed) enter image description here

    • Type in the setting you are searching for like "method with accessor "

    • Turn off the corresponding Inspection. enter image description here
    • Open Settings (Default shortcuts)
      • Windows/Linux: Ctrl + Alt + S
      • Mac: + ,
    • Go to Editor -> Inspections -> Scala -> Method Signature
    • Find the inspection required and turn it off.

Upvotes: 1

Micho
Micho

Reputation: 3963

This inspection is warning you the method is not following the recommended convention to use parameterless methods whenever there are no parameters and the method have no side effects.

enter image description here

To disable it in IntelliJ IDEA, go to: Settings... -> Editor -> Code Style -> Inspections -> Scala -> Method Signature and uncheck Method with accessor-like name is empty paren

Upvotes: 6

Related Questions