2

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.

Community
  • 1
  • 1
stanislav.chetvertkov
  • 1,620
  • 3
  • 13
  • 24

0 Answers0