Allow underscore imports of companion object's items in Scalastyle

92 Views Asked by At

I'd like to make scalastyle to ignore underscore imports in case when it is companion object's fields that are being imported(it makes sense to me):

class Item {
  import Item._ //scalastyle marks it as a warning

}

object Item {
  case object Nested
  def someMethod(): Unit = {..}
}

UnderscoreImportChecker is responsible for this inspection, but it has no configuration parameters

<check level="warning" class="org.scalastyle.scalariform.UnderscoreImportChecker" enabled="true"></check>

Here is the similar question: Companion class requires import of Companion object methods and nested objects?

I'd like to ask if there is a way to write a custom Checker(I'll try to investigate it)?

P.S. I'm aware that I can use //scalastyle:off or explicit imports but it would be repetitive and inconvenient to use.

0

There are 0 best solutions below