Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Packwerk work in in-repo gems and other dependencies #47

Open
lastgabs opened this issue Oct 23, 2020 · 5 comments
Open

Make Packwerk work in in-repo gems and other dependencies #47

lastgabs opened this issue Oct 23, 2020 · 5 comments
Labels
enhancement New feature or request

Comments

@lastgabs
Copy link
Contributor

Description
Currently Packwerk can only check constant references that are being autoloaded. This excludes any dependencies and in-repo gems that could exist in a codebase. Especially for in-repo gems we have a strong need for boundary checking.

To Reproduce
Add a package.yml with enforced privacy or dependency violations and run packwerk update or packwerk check, neither of these will work for non-autoloaded packages.

Expected Behaviour
Dependencies and other packages that are not autoloaded should still have boundaries enforced.

Version Information

  • Packwerk: v1.0.0
  • Ruby: 2.7.1p83
@lastgabs lastgabs added the bug Something isn't working label Oct 23, 2020
@tomstuart
Copy link
Contributor

@lastgabs and I discussed this on the pod hangout and I suggested she try adding the in-repo gems to the load_paths in packwerk.yml and see what happens. She’s going to do that shortly and report back.

@tomstuart
Copy link
Contributor

(Maybe I should’ve suggested package_paths instead. The distinction is not very clear to me.)

@exterm
Copy link
Contributor

exterm commented Oct 14, 2021

I investigated how to decouple from zeitwerk and documented the findings in Shopify/constant_resolver#26.

Seems actually like using Sorbet is the best bet, but that would be a major rewrite of packwerk. Might still make sense at some point.

@alexevanczuk alexevanczuk added enhancement New feature or request and removed bug Something isn't working labels Dec 6, 2022
@alexevanczuk
Copy link
Contributor

This is an older issue but also wanted to link #218 which provides an implementation for and interesting discussion around allowing packwerk to work in any gems that use zeitwerk for autoloading!

@Mifrill
Copy link

Mifrill commented Apr 18, 2023

Hey, I just wanna ask for any updates on this.
I face it during the research for trying to enforce boundaries of external gem with package.yml config.
I.e. Gemfile includes any external gem and this gem has package.yml file with a public interface, and I want to enforce privacy violations for that external gem. I thought it possible via extension config, but it's not, and packwerk validate getting failed due to relative paths checks, even if I put explicitly absolute path to main package.yml file:

dependencies:
  - ../my_external_gems/my_gem

and packwerk update-todo also cannot catch violations from external gem as well, even with Zeitwerk::Loader.eager_load_all setup. So I think this issue is exactly about it (in terms of other dependencies). Is it in the plans?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants