Apply suggestions from code review
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com> Signed-off-by: XuehaiPan <XuehaiPan@pku.edu.cn>
This commit is contained in:
parent
d1aac8857a
commit
62a63063bb
@ -40,14 +40,14 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
def update_report
|
def update_report
|
||||||
return update_report_impl if $stdout.tty?
|
return output_update_report if $stdout.tty?
|
||||||
|
|
||||||
redirect_stdout($stderr) do
|
redirect_stdout($stderr) do
|
||||||
return update_report_impl
|
output_update_report
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_report_impl
|
def output_update_report
|
||||||
args = update_report_args.parse
|
args = update_report_args.parse
|
||||||
|
|
||||||
# Run `brew update` (again) if we've got a linuxbrew-core CoreTap
|
# Run `brew update` (again) if we've got a linuxbrew-core CoreTap
|
||||||
|
|||||||
@ -277,13 +277,11 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
def shellcheck
|
def shellcheck
|
||||||
# Always use the latest brewed shellcheck
|
|
||||||
ensure_formula_installed!("shellcheck", latest: true,
|
ensure_formula_installed!("shellcheck", latest: true,
|
||||||
reason: "shell style checks").opt_bin/"shellcheck"
|
reason: "shell style checks").opt_bin/"shellcheck"
|
||||||
end
|
end
|
||||||
|
|
||||||
def shfmt
|
def shfmt
|
||||||
# Always use the latest brewed shfmt
|
|
||||||
ensure_formula_installed!("shfmt", latest: true,
|
ensure_formula_installed!("shfmt", latest: true,
|
||||||
reason: "formatting shell scripts")
|
reason: "formatting shell scripts")
|
||||||
HOMEBREW_LIBRARY/"Homebrew/utils/shfmt.sh"
|
HOMEBREW_LIBRARY/"Homebrew/utils/shfmt.sh"
|
||||||
|
|||||||
@ -438,7 +438,7 @@ module Kernel
|
|||||||
|
|
||||||
# Ensure the given formula is installed
|
# Ensure the given formula is installed
|
||||||
# This is useful for installing a utility formula (e.g. `shellcheck` for `brew style`)
|
# This is useful for installing a utility formula (e.g. `shellcheck` for `brew style`)
|
||||||
def ensure_formula_installed!(formula_or_name, latest: false, reason: "",
|
def ensure_formula_installed!(formula_or_name, reason: "", latest: false,
|
||||||
output_to_stderr: true, quiet: false)
|
output_to_stderr: true, quiet: false)
|
||||||
if output_to_stderr || quiet
|
if output_to_stderr || quiet
|
||||||
file = if quiet
|
file = if quiet
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user