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

Bump some utils/ files to Sorbet typed: strict #19094

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

issyl0
Copy link
Member

@issyl0 issyl0 commented Jan 14, 2025

  • 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?

@issyl0 issyl0 marked this pull request as ready for review January 14, 2025 23:45
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.

Good to go whenever you are! All comments are non-blocking, we can always clean this up post merge.

Library/Homebrew/utils/analytics.rb Outdated Show resolved Hide resolved
Library/Homebrew/utils/analytics.rb Outdated Show resolved Hide resolved
@@ -97,8 +97,8 @@ def pypi_info(new_version: nil)
sig { returns(String) }
def to_s
if valid_pypi_package?
out = name
out += "[#{extras.join(",")}]" if extras.present?
out = T.must(name)
Copy link
Member

Choose a reason for hiding this comment

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

If we're doing a T.must here feels like it might be nice to enforce in def name and def initialize that it's a String type instead?

Library/Homebrew/utils/pypi.rb Outdated Show resolved Hide resolved
Library/Homebrew/utils/pypi.rb Outdated Show resolved Hide resolved
Library/Homebrew/utils/pypi.rb Outdated Show resolved Hide resolved
Library/Homebrew/utils/pypi.rb Outdated Show resolved Hide resolved
tcsh: "~/.tcshrc",
zsh: "~/.zshrc",
}.freeze,
T::Hash[T.nilable(Symbol), String],
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
T::Hash[T.nilable(Symbol), String],
T::Hash[Symbol, String],

feels more appropriate?

Copy link
Member Author

Choose a reason for hiding this comment

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

Tried that, but in def profile’s SHELL_PROFILE_MAP.fetch(preferred, "~/.profile") , preferred can be nil and there’s no default fallback.

Copy link
Member

Choose a reason for hiding this comment

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

Does that produce a type-error? Feels like it might be nicer in that case to have an early return rather than attempting a fetch with nil. Thoughts?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. And good idea, yeah, I'll do that.

Library/Homebrew/utils/spdx.rb Show resolved Hide resolved
Library/Homebrew/utils/tty.rb Outdated Show resolved Hide resolved
@issyl0 issyl0 force-pushed the utils-sorbet-strict branch from 7a069dd to 4941137 Compare January 15, 2025 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants