scalastyle

How to suppress Scalastyle warning?


I got following code:

    string match {
      case Regex(_, "1", "0", _, _)    =>
      case Regex(_, "1", "1", null, _) =>
    }

Scalastyle is complaining about usage of null which cannot be avoided here. Any way I can suppress warning just for this line?


Solution

  • Scalastyle understands suppression comments:

    // scalastyle:off <rule id>
    ...
    // scalastyle:on <rule id>
    

    Rule ids are listed here

    In your case, the id is simply null:

    // scalastyle:off null
    ...
    // scalastyle:on null
    

    This was also answered on the mailing list