Skip to content

Collectors

Sam Edwards edited this page Jun 9, 2024 · 2 revisions

This is a pluggable way to provide a set of Collectors to gather data and metrics in your projects. There should be some off-the-shelf standard ones, and it should be easy for you to add your own.

NOTE: These are here to provide some ideas for use cases for Collectors to give a general vision of what can be done. There are some implementations inside this repository, but they are being used for projects at Square and do not provide a stable API. Feel free to fork them and use them to best suit your project's needs. can be used. However, these serve as an example on how Invert could be used, and the with these you can see the general vision.

Collector Types

Each of these types can be collected by module, or for the entire project.

Markdown/String

It's hard to predict all use cases, so this serves as a general catch-all way to surface information about contents of your module or your entire project.

Code References

This allows you to collect a reference in a given file with a lineStart and lineEnd. This is helpful to allow deep linking into GitHub to provide more context.

Category: Imports and References

  • Determine where a certain class or import is being referenced. This is could be helpful for auditing or migrations to help surface usages and group them by owner.

Category: Annotated Methods or Classes

  • A count and/or list of reference to where the annotation is used, and grouped by type. Examples
  • @Deprecated
  • @Suppress
  • @Test

Category: Dependency Injection Provides & Injects

  • Type specific @Provides and @Binds where items are bound to the Dagger Dependency graph.
    • Additionally, this could be determined for Anvil.
    • Or it could be done for other DI libraries.
  • Type specific @Inject injection points for Dagger and Anvil.

Numerical Metric

Data that can be expressed numerically. Additionally, metadata (string/markdown) can be provided along with it for context.

  • number of lines of code
  • number of files
  • number of methods
  • number of ...

Boolean Metric

This boolean metric can be linked by module or by Project. Additionally, metadata (string/markdown) can be provided along with it for context.

  • Does this module have ...