Giter VIP home page Giter VIP logo

unused-code's Introduction

Unused Code

maven scaladoc

find and warn, remove unused public classes, methods by scalafix SyntacticRule.

setup

project/plugins.sbt

addSbtPlugin("com.github.xuwei-k" % "unused-code-plugin" % "version")

sbt shell

> unusedCode
> scalafix WarnUnusedCode
> scalafix RemoveUnusedCode

config example

build.sbt

import scala.concurrent.duration.*

ThisBuild / unusedCodeConfig ~= { c =>
  c.copy(
    excludeNameRegex = Set(
      ".*Server"
    ),
    excludePath = c.excludePath ++ Set(
      "glob:some-project/**"
    ),
    excludeGitLastCommit = Some(
      365.days
    ),
    excludeMainMethod = false,
    dialect = unused_code.Dialect.Scala3,
  )
}

unused-code's People

Contributors

dependabot[bot] avatar scala-steward-bot avatar xuwei-k avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

unused-code's Issues

Don't remove setter

class A {
  private var b: Int = 0
  def foo_=(a: Int): Unit = b = a
  def foo: Int = b
}

object A{
  (new A).foo = 3
}

update scalameta and scalafix version

compiler/src/dotty/tools/dotc/transform/patmat/Space.scala:938: error: error in interpolated string: identifier, `this' or block expected
[error]     debug.println(i"checking redundancy in $_match")
[error]                                             ^
[error] 	at scala.meta.internal.parsers.Reporter.syntaxError(Reporter.scala:16)
[error] 	at scala.meta.internal.parsers.Reporter.syntaxError$(Reporter.scala:16)
[error] 	at scala.meta.internal.parsers.Reporter$$anon$1.syntaxError(Reporter.scala:22)
[error] 	at scala.meta.internal.parsers.Reporter.syntaxError(Reporter.scala:17)
[error] 	at scala.meta.internal.parsers.Reporter.syntaxError$(Reporter.scala:17)
[error] 	at scala.meta.internal.parsers.Reporter$$anon$1.syntaxError(Reporter.scala:22)
[error] 	at scala.meta.internal.parsers.ScalametaParser.unquoteExpr(ScalametaParser.scala:2316)
[error] 	at scala.meta.internal.parsers.ScalametaParser.$anonfun$interpolateTerm$1(ScalametaParser.scala:2233)

`update` method

object UpdateTest {
  object UpdateTest1 {
    def update(x: Int, y: Int): Unit = ()
  }

  def main(args: Array[String]): Unit = {
    UpdateTest1(2) = 3
  }
}

InvocationTargetException when running unusedCode

When running unusedCode from sbt shell in our codebase we always get:

[error] (Global / unusedCode) java.lang.reflect.InvocationTargetException

with no additional output, for every sbt module. Is it some known issue/limitation of the current version of the plugin? If not, do you know if there is some nice way to track down the real reason behind it? I've tried sbt --verbose --debug but it doesn't help much in this case. I don't have any minimal yet, but I can try to create some

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.