Separate filtering from reference extraction
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 1.9k
- Forks
- 121
- Avg merge
- 2m
- Merged PRs (30d)
- 1
Description
We currently extract + filter references all in one step, which can sometimes be a point of confusion.
In particular, we do a lot of filtering: https://github.com/Shopify/packwerk/blob/c6b06b8240f4a473cf4599f8835aba5145bca684/lib/packwerk/reference_extractor.rb#L50-L71
You can see we remove
- locally referenced constants,
- references to constants packwerk is unable to resolve, or unable to resolve to a package, and
- references to constants in the same package as the source package of the reference.
There could be a light refactor here so that we can extract all references, followed by another layer to do the filtering. It should lend itself to easier testing and a lighter set of test suites.
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 with lib/packwerk/reference_extractor.rb, especially lines 50-71, to understand how reference extraction and filtering are currently combined. Separate the extraction step from the listed filtering rules, then verify that the behavior is preserved while the filtering can be tested independently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- tooling
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100