-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Alphabetize the brew outdated
formula listing.
#4178
Alphabetize the brew outdated
formula listing.
#4178
Conversation
Sorts by `Formula#<=>`. Includes updated test example.
Library/Homebrew/cmd/outdated.rb
Outdated
outdated_formulae = formulae.select { |f| f.outdated?(fetch_head: fetch_head) } | ||
outdated_formulae = formulae | ||
.select { |f| f.outdated?(fetch_head: fetch_head) } | ||
.sort |
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.
Leave the first line as it was, and align .sort
with .select
.
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.
Fixed in dougal/brew@c80842449
expect { brew "outdated" } | ||
.to output("testball\n").to_stdout | ||
.to output("foo\ntestball\n").to_stdout |
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.
Did you check if this specific case actually fails without sort
?
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.
Yes. Commenting out the sort
line results in the following failure:
1) brew outdated quiet output prints outdated Formulae
Failure/Error:
expect { brew "outdated" }
.to output("foo\ntestball\n").to_stdout
.and not_to_output.to_stderr
.and be_a_success
expected block to output "foo\ntestball\n" to stdout, but output "testball\nfoo\n"
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.
I assume that's locally but not on CI.
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.
Yes, locally.
CI should never fail as the tests were committed with the changes. I assume, unless I am misunderstanding something.
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.
I just mean that on CI, which is using HFS+, it probably always passes regardless of the sort, whereas locally it fails without the sort because you're using APFS. I'm not sure there's anything to be done about that really in terms of making the test actually test something on CI but I don't think we need to worry about sort
not working.
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 insight on CI using HFS+, thanks.
I originally tried making the the test case more expansive, with different formulae inserted in different orders. I simplified it as I wasn't sure the expanded test case provided any value.
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.
I don't think we need to worry about
sort
not working.
Well, the test is not for sort
itself, but for the fact that the output has to be sorted. Anyways, as long as it fails locally on APFS, it is good enough.
Thank you for your first contribution to Homebrew, @dougal! |
Sorts the output of
brew outdated
byFormula#<=>
.For me this significantly speeds up scanning the list to look for formula I consider critical to my work.
Includes updated test example.
Not strictly speaking. I modified an existing test.
brew style
with your changes locally?brew tests
with your changes locally?