scalaintellij-ideascalastyle

How to supress a specific scalastyle rule in IDEA?


I want to suppress no.finalize rule of ScalaStyle only for one particular class.

I figured that one approach to suppress IntelliJ IDEA's inspection is to add following comment at the beginning of the class:

//noinspection ScalaStyle

However, this will suppress all ScalaStyle rules for that particular class. I want to suppress only one rule selectively.

Note that I have already tried scalastyle's suppression approach which is to use // scalastyle:off no.finalize. However, it is not honored by IntelliJ IDEA.

I am using IDEA version 2018.2.5 (Community Edition).


Solution

  • // scalastyle:off <rule id>
    

    In your case:

    // scalastyle:off no.finalize
    

    List of ids: http://www.scalastyle.org/rules-dev.html

    The solution works for IDEA 2019.3. Better to update the IDE with Scala plugin