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

Enable UnpackStrategy types #15025

Merged
merged 5 commits into from Mar 22, 2023
Merged

Conversation

dduugg
Copy link
Sponsor Member

@dduugg dduugg commented Mar 20, 2023

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

  • Removes Pathname refinements in two modules, PathnameEachDirectory and Bom, that were confined to the file they were defined in, and which better written as utility functions.
  • Converts the Pathname refinements in another module, Magic, to monkey-patch Pathname instead. (This was already being included in 34 files, so it was already basically a monkey-patch). Monkey-patching isn't great, but it's still generally better than using refinements for reasons discussed in Use ActiveSupport Hash#assert_valid_keys instead of refinement #15018
  • Various other small fixes to enable typing

@BrewTestBot
Copy link
Member

Review period will end on 2023-03-21 at 22:14:20 UTC.

@BrewTestBot BrewTestBot added the waiting for feedback Merging is blocked until sufficient time has passed for review label Mar 20, 2023
@dduugg dduugg force-pushed the enable-unpack-strategy-types branch from 421c86b to 877af48 Compare March 20, 2023 22:22
else
# Length of the longest regex (currently Tar).
# The `T.let` is a workaround until we have https://github.com/sorbet/sorbet/pull/6865
T.let(binread(262), T.nilable(String)) || ""
Copy link
Sponsor Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

262 was formerly MAX_MAGIC_NUMBER_LENGTH, but i didn't want to add more than necessary to the Pathname space, or add any redirection.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dduugg please make it a named variable at least instead for readability, thanks!

Suggested change
T.let(binread(262), T.nilable(String)) || ""
max_magic_number_length = 262
T.let(binread(max_magic_number_length), T.nilable(String)) || ""

""
else
# Length of the longest regex (currently Tar).
# The `T.let` is a workaround until we have https://github.com/sorbet/sorbet/pull/6865
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# The `T.let` is a workaround until we have https://github.com/sorbet/sorbet/pull/6865
# FIXME: The `T.let` is a workaround until we have https://github.com/sorbet/sorbet/pull/6865

@BrewTestBot BrewTestBot removed the waiting for feedback Merging is blocked until sufficient time has passed for review label Mar 22, 2023
@BrewTestBot
Copy link
Member

Review period ended.

@dduugg dduugg force-pushed the enable-unpack-strategy-types branch from b37c313 to 91afda6 Compare March 22, 2023 00:37
@dduugg
Copy link
Sponsor Member Author

dduugg commented Mar 22, 2023

Updated PR to address comments and fix merge conflicts. PTAL @reitermarkus @MikeMcQuaid

Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! If my one suggestion is correct: please apply it and merge/enable auto-merge without another round of review being needed. Feel free to wait for @reitermarkus if desired.

Library/Homebrew/extend/pathname.rb Outdated Show resolved Hide resolved
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
@dduugg dduugg merged commit 65d858d into Homebrew:master Mar 22, 2023
21 of 22 checks passed
@dduugg dduugg deleted the enable-unpack-strategy-types branch March 22, 2023 19:06
@github-actions github-actions bot added the outdated PR was locked due to age label Apr 22, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants