Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

[WIP] Scalafix rule for warning unused values and imports that works both in Scala2 and Scala3.

License

Notifications You must be signed in to change notification settings

tanishiking/scalafix-unused

Repository files navigation

scalafix-unused

Codacy Badge

CI

Configuration

Default Configuration

Unused {
  params = true,
  locals = true,
  imports = true,
  privates = true,
  patvars = true,
}

Limitations

Wildcard import against non-package

import collection.mutable._ // ok (assert: Unused)

class Bippo {
  def length: Int = 123
  class Tree
}

object p1 {
  val c: Bippo = new Bippo
}

def foo = {
  {
    // scalafix-unused can't detect unused import
    import p1._
    println(123)
  }
  {
    // scalafix-unused can't detect unused import
    import p1.c._
    println(123)
  }
}

def bar = {
  import p1.c._
  println(length)
}

This limitation is required because length called from def bar has symbol example::Bippo#length()., and we have no information to tell the length is imported by import pc.c._.

About

[WIP] Scalafix rule for warning unused values and imports that works both in Scala2 and Scala3.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages