Expose comment groups that aren't attached to a definition
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 55/100
Research direction
Start by tracing how Rubydex groups comments during indexing and where it associates them with definitions, focusing on Definition#comments and the document representation. Review the standalone RBS alias example and the related module_function def case to understand which groups are currently discarded. Done means unattached groups are retained and can be queried per document or by prefix without making linter rules reread every file.
Written by the indexing model from the issue text.
Description
Rubydex groups consecutive comments while indexing, but keeps a group only when it sits
directly above a definition, and exposes it only through Definition#comments. Every other
comment group is dropped at index time.
That makes some linter rules expensive. Our case is an RBS inline type alias on its own in a
class body, which isn't attached to anything:
class Foo
#: type rel = Shop::PrivateRelation
def bar; end
end
A rule that needs to see that alias has to re-read every file from disk. Over ~155k files that
costs 16–18s, against about 3s for a rule that only walks Definition#comments, even though
the indexer already read and parsed those comments.
https://delta.shopify.io/shop/world/pull/2278180
Proposal: keep unattached comment groups and expose them per document (e.g. Document#comments),
or offer a graph-wide query by prefix such as #:. A longer-term option is to index inline RBS
annotations, like #: type aliases, as their own definition kind.
Related: comments on a module_function def aren't attached to the method definition either.
- Dominant language
- Rust
- Stars
- 382
- Forks
- 30
- Avg merge
- 16h 57m
- Merged PRs (30d)
- 10
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing 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.
More from Shopify/rubydex
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
Maintainers usually reply within 1 day
-
Constant reference unresolved inside a class nested in its own superclass when the outer namespace is only implied by compact definitionsPossibly taken @efegokdemir claimed this 29 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 45/100
Maintainers usually reply within 1 day
-
`self.private :foo` is reported as an invalid visibility call and ignoredPossibly taken @RaphaelFakhri claimed this 30 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 35/100
Maintainers usually reply within 1 day
-
Incorrect resolved superclass namePossibly taken @efegokdemir claimed this 38 days ago. Openbug roundhouse
Difficulty 4/5 1-2 days Newbie friendliness 25/100
Maintainers usually reply within 1 day
-
`resolve_constant` returns nil for names with three or more segmentsPossibly taken @vinistock claimed this 33 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 65/100
Maintainers usually reply within 1 day
Similar issues
-
CI/CD ignore-for-release
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
eclipse-ankaios/ankaios#844 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
std: `SliceIndex<str>` missing for `std::ops` ranges, so generic `R: SliceIndex<str>` bounds failOpen
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
symposium-dev/symposium#530 ·
Maintainers usually reply within 5 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day