Git Product home page Git Product logo

Comments (6)

cortinico avatar cortinico commented on June 2, 2024 3

This won't be easy to implement as detekt doesn't have the capability to scan the entire codebase and keep a context. Every rule are effectively an implementation of the visitor pattern implemented on the node of the AST.

We could extend detekt to start collecting those aggregated metrics (i.e. # of function usages vs definitions), but this is not in the roadmap

from detekt.

schalkms avatar schalkms commented on June 2, 2024 2

In my opinion, this feature might be better suited for a dedicated compiler plugin.
Technically it's possible to implement this with detekt. However, it will require more effort than just implementing a new rule. One needs to gather the information from BindingContext or from some other Kotlin compiler APIs.

from detekt.

schalkms avatar schalkms commented on June 2, 2024 2

Won’t implement for the reasons listed above

from detekt.

mgroth0 avatar mgroth0 commented on June 2, 2024

Thanks @cortinico . Is there an existing issue for keeping a context through an entire source set / module / code base? Or shall I make one?

from detekt.

cortinico avatar cortinico commented on June 2, 2024

I think the question is more for @detekt/maintainers if we ever want to implement such capability or not

from detekt.

TWiStErRob avatar TWiStErRob commented on June 2, 2024

Agree, detekt doesn't have the capabilities. Even if we implemented all the tracking and collation necessary for this, we would be missing out on usages from Java (and Scala/Groovy/Clojure/etc.).


You can however, write an Android Lint check for this, and use it in non-Android projects too via com.android.lint standalone plugin (see docs). That at least covers Java and .class-file usages. You can have a look at UnusedIds and UnusedResources for inspiration.

from detekt.

Related Issues (20)

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.