How to suppress Scalastyle warning?

Kiril picture Kiril · Feb 21, 2014 · Viewed 18.6k times · Source

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?

Answer

mbarton picture mbarton · Feb 21, 2014

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