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

[Bug Report] Default require behaviour #335

Closed
gmcgibbon opened this issue Mar 14, 2023 · 0 comments · Fixed by #336
Closed

[Bug Report] Default require behaviour #335

gmcgibbon opened this issue Mar 14, 2023 · 0 comments · Fixed by #336
Assignees
Labels
bug Something isn't working

Comments

@gmcgibbon
Copy link
Member

gmcgibbon commented Mar 14, 2023

Description
Requiring packwerk via require "packwerk" (the default require) sets autoloads and some upfront requires. Tools like T::Utils.run_all_sig_blocks triggers signatures to be evaluated, which expands Packwerk into memory as it loads constants in sigs.

To Reproduce
A scenario like #334 using T::Utils.run_all_sig_blocks.

Expected Behaviour
T::Utils.run_all_sig_blocks should not inflate Packwerk into memory.

Screenshots
N/A

Version Information

  • Packwerk: edge
  • Ruby 3.2.1

Additional Context
We don't seem to want to encourage developers reach for require: false as of #304. What we can do instead is remove the requires from the main entrypoint file and make sure no more are added (and thus no sigs evaluated). We don't seem to want to move autoloads out of the default require for API design reasons.

@gmcgibbon gmcgibbon added the bug Something isn't working label Mar 14, 2023
@gmcgibbon gmcgibbon self-assigned this Mar 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant