Fix Rubocop warnings (without brew style --fix)

This commit is contained in:
Mike McQuaid 2025-02-28 09:59:32 +00:00
parent fe76a5155b
commit 7a5d4256e5
No known key found for this signature in database
6 changed files with 17 additions and 39 deletions

View File

@ -748,15 +748,13 @@ module Homebrew
def check_for_unlinked_but_not_keg_only def check_for_unlinked_but_not_keg_only
unlinked = Formula.racks.reject do |rack| unlinked = Formula.racks.reject do |rack|
if (HOMEBREW_LINKED_KEGS/rack.basename).directory? next true if (HOMEBREW_LINKED_KEGS/rack.basename).directory?
true
else
begin begin
Formulary.from_rack(rack).keg_only? Formulary.from_rack(rack).keg_only?
rescue FormulaUnavailableError, TapFormulaAmbiguityError rescue FormulaUnavailableError, TapFormulaAmbiguityError
false false
end end
end
end.map(&:basename) end.map(&:basename)
return if unlinked.empty? return if unlinked.empty?

View File

@ -809,11 +809,8 @@ on_request: installed_on_request?, options:)
options |= inherited_options options |= inherited_options
options &= df.options options &= df.options
installed_on_request = if df.any_version_installed? && tab.present? && tab.installed_on_request installed_on_request = df.any_version_installed? && tab.present? && tab.installed_on_request
true installed_on_request ||= false
else
false
end
fi = FormulaInstaller.new( fi = FormulaInstaller.new(
df, df,

View File

@ -81,13 +81,11 @@ class Locale
end end
[:language, :script, :region].all? do |var| [:language, :script, :region].all? do |var|
if other.public_send(var).nil? next true if other.public_send(var).nil?
true
else
public_send(var) == other.public_send(var) public_send(var) == other.public_send(var)
end end
end end
end
def eql?(other) def eql?(other)
unless other.is_a?(self.class) unless other.is_a?(self.class)

View File

@ -85,21 +85,15 @@ module Homebrew
run_shellcheck(shell_files, output_type, fix:) run_shellcheck(shell_files, output_type, fix:)
end end
shfmt_result = if files.present? && shell_files.empty? shfmt_result = files.present? && shell_files.empty?
true shfmt_result ||= run_shfmt(shell_files, fix:)
else
run_shfmt(shell_files, fix:)
end
has_actionlint_workflow = actionlint_files.any? do |path| has_actionlint_workflow = actionlint_files.any? do |path|
path.to_s.end_with?("/.github/workflows/actionlint.yml") path.to_s.end_with?("/.github/workflows/actionlint.yml")
end end
odebug "actionlint workflow detected. Skipping actionlint checks." if has_actionlint_workflow odebug "actionlint workflow detected. Skipping actionlint checks." if has_actionlint_workflow
actionlint_result = if files.present? && (has_actionlint_workflow || actionlint_files.empty?) actionlint_result = files.present? && (has_actionlint_workflow || actionlint_files.empty?)
true actionlint_result ||= run_actionlint(actionlint_files)
else
run_actionlint(actionlint_files)
end
if output_type == :json if output_type == :json
Offenses.new(rubocop_result + shellcheck_result) Offenses.new(rubocop_result + shellcheck_result)

View File

@ -71,9 +71,6 @@ module Utils
def report_package_event(measurement, package_name:, tap_name:, on_request: false, options: "") def report_package_event(measurement, package_name:, tap_name:, on_request: false, options: "")
return if not_this_run? || disabled? return if not_this_run? || disabled?
# ensure on_request is a boolean
on_request = on_request ? true : false
# ensure options are removed (by `.compact` below) if empty # ensure options are removed (by `.compact` below) if empty
options = nil if options.blank? options = nil if options.blank?
@ -137,9 +134,6 @@ module Utils
return if not_this_run? || disabled? return if not_this_run? || disabled?
return if ENV["HOMEBREW_TEST_BOT_ANALYTICS"].blank? return if ENV["HOMEBREW_TEST_BOT_ANALYTICS"].blank?
# ensure passed is a boolean
passed = passed ? true : false
# Tags must have low cardinality. # Tags must have low cardinality.
tags = { tags = {
passed:, passed:,

View File

@ -340,11 +340,8 @@ module PyPI
show_info = !print_only && !silent show_info = !print_only && !silent
ohai "Retrieving PyPI dependencies for \"#{input_packages.join(" ")}\"..." if show_info ohai "Retrieving PyPI dependencies for \"#{input_packages.join(" ")}\"..." if show_info
print_stderr = if verbose && show_info print_stderr = verbose && show_info
true print_stderr ||= false
else
false
end
found_packages = pip_report(input_packages, python_name:, print_stderr:) found_packages = pip_report(input_packages, python_name:, print_stderr:)
# Resolve the dependency tree of excluded packages to prune the above # Resolve the dependency tree of excluded packages to prune the above