-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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.
!!(config_true?(:analyticsmessage) && | ||
config_true?(:caskanalyticsmessage) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!!(config_true?(:analyticsmessage) && | |
config_true?(:caskanalyticsmessage) && | |
return false unless config_true?(:analyticsmessage) | |
return false unless config_true?(:caskanalyticsmessage) | |
influx_message_displayed? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or something? I presume the issue here is that config_true?
can be nil
? If so: may make sense to fix that up.
config_true?(:caskanalyticsmessage) && | ||
influx_message_displayed? | ||
influx_message_displayed?) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
influx_message_displayed?) |
@@ -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) |
There was a problem hiding this comment.
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?
out = name | ||
out += "[#{extras.join(",")}]" if extras.present? | ||
out = T.must(name) | ||
out += "[#{extras&.join(",")}]" if extras.present? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
out += "[#{extras&.join(",")}]" if extras.present? | |
if (pypi_extras = extras.presence) | |
out += "[#{pypi_extras.join(",")}]" | |
end |
@@ -327,12 +328,12 @@ def self.update_python_resources!(formula, version: nil, package_name: nil, extr | |||
# Resolve the dependency tree of all input packages | |||
show_info = !print_only && !silent | |||
ohai "Retrieving PyPI dependencies for \"#{input_packages.join(" ")}\"..." if show_info | |||
found_packages = pip_report(input_packages, python_name:, print_stderr: verbose && show_info) | |||
found_packages = pip_report(input_packages, python_name:, print_stderr: !(verbose && show_info).nil?) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
found_packages = pip_report(input_packages, python_name:, print_stderr: !(verbose && show_info).nil?) | |
print_stderr = !(verbose && show_info).nil? | |
found_packages = pip_report(input_packages, python_name:, print_stderr:) |
# Resolve the dependency tree of excluded packages to prune the above | ||
exclude_packages.delete_if { |package| found_packages.exclude? package } | ||
ohai "Retrieving PyPI dependencies for excluded \"#{exclude_packages.join(" ")}\"..." if show_info | ||
exclude_packages = pip_report(exclude_packages, python_name:, print_stderr: verbose && show_info) | ||
exclude_packages += [Package.new(main_package.name)] unless main_package.nil? | ||
exclude_packages = pip_report(exclude_packages, python_name:, print_stderr: !(verbose && show_info).nil?) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exclude_packages = pip_report(exclude_packages, python_name:, print_stderr: !(verbose && show_info).nil?) | |
print_stderr = !(verbose && show_info).nil? | |
exclude_packages = pip_report(exclude_packages, python_name:, print_stderr:) |
exclude_packages = pip_report(exclude_packages, python_name:, print_stderr: verbose && show_info) | ||
exclude_packages += [Package.new(main_package.name)] unless main_package.nil? | ||
exclude_packages = pip_report(exclude_packages, python_name:, print_stderr: !(verbose && show_info).nil?) | ||
exclude_packages += [Package.new(T.must(main_package.name))] unless main_package.nil? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exclude_packages += [Package.new(T.must(main_package.name))] unless main_package.nil? | |
if (main_package_name = main_package&.name) | |
exclude_packages += [Package.new(main_package_name)] | |
end |
tcsh: "~/.tcshrc", | ||
zsh: "~/.zshrc", | ||
}.freeze, | ||
T::Hash[T.nilable(Symbol), String], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
T::Hash[T.nilable(Symbol), String], | |
T::Hash[Symbol, String], |
feels more appropriate?
T::Hash[T.any(Symbol, String), T.untyped], | ||
T::Array[String], | ||
), | ||
).returns( | ||
[ | ||
T::Array[T.any(String, Symbol)], T::Array[String] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice if this could use either String
or Symbol
consistently as the Hash keys/first Array values? Maybe outside the scope of this PR.
@@ -152,7 +162,7 @@ def color? | |||
return false if Homebrew::EnvConfig.no_color? | |||
return true if Homebrew::EnvConfig.color? | |||
|
|||
@stream.tty? | |||
!!@stream&.tty? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice to avoid the added need for &
here if possible.
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?typed: strict
in all (non-package) files in Homebrew organisation #17297.