doctor: simplify handling of slow checks

Some (rather slow) checks should run after all other checks. Make that
more obvious by removing them from the sorted list of all checks and
then re-appending them to the resulting list. (Should be slightly more
efficient than the `<array>.reverse.uniq.reverse` incantation, though
that hardly matters given the cumulated run time of all the checks.)

Slightly extend the list after verifying what the slowest checks are for
various Homebrew installations (slowest check last).

Closes Homebrew/homebrew#47753.

Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
This commit is contained in:
Martin Afanasjew 2016-01-02 01:03:54 +01:00
parent c9097b40f9
commit bcedfe64e8

View File

@ -12,9 +12,13 @@ module Homebrew
checks.inject_dump_stats! if ARGV.switch? "D" checks.inject_dump_stats! if ARGV.switch? "D"
if ARGV.named.empty? if ARGV.named.empty?
methods = checks.all.sort slow_checks = %w[
methods << "check_for_linked_keg_only_brews" << "check_for_outdated_homebrew" check_for_broken_symlinks
methods = methods.reverse.uniq.reverse check_missing_deps
check_for_outdated_homebrew
check_for_linked_keg_only_brews
]
methods = (checks.all.sort - slow_checks) + slow_checks
else else
methods = ARGV.named methods = ARGV.named
end end