Migrate Spoom to use Rubydex
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 355
- Forks
- 24
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 17
Description
Spoom performs its own indexing to power a few different features from metrics collection to dead code detection.
-
Code metrics (
CodeMetricsVisitor): collects a bunch of metrics about the code and gradual typing usage:- number of classes, modules, singleton classes (with and without type members)
- number of RBS scope annotations (
@abstract,@interface, etc.) - number of methods (singleton or not)
- number of attribute accessors
- number of signatures (sig or RBS comment)
- number of
T.calls - number of RBS inline assertion comments
This can all be replace by querying the global graph if we support RBS comments.
-
Model representation (
Model): builds a complete representation of the declarations, definitions and their relationship form a codebase. This is the meat behind dead code detection and any "smart" analysis that needs advanced features like constant resolution or inheritance linearization.I believe this whole part of the codebase should be replace 1:1 by Saturn. This is going to be an invasive change.
-
Dead code detection (
Deadcode) this comes with many sub-features:- Indexing both
.rband.erbfiles - Indexing declarations by unqualified names
- Indexing references to unqualified names (both constants and methods)
- Plugin system to listen to events such as entering a definition or entering a call
- Indexing both
There is some work in progress here: https://github.com/Shopify/spoom/blob/at-test-indexer/lib/spoom/deadcode/index.rb and early results are really encouraging with a 5x speed increase and 2x less memory.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading lib/spoom/sorbet/metrics/code_metrics_visitor.rb, lib/spoom/model/model.rb, and lib/spoom/deadcode/index.rb. Compare the existing dead-code index with the at-test-indexer branch and identify how Rubydex or Saturn would cover metrics, model representation, and dead-code indexing. Done means these indexing responsibilities are migrated without losing the listed features.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby, rust
- Domain
- devtools, tooling
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100