Skip to content

SkipConditions: join multiple skip messages#21708

Merged
MikeMcQuaid merged 7 commits into
Homebrew:mainfrom
rexmhall09:main
Mar 11, 2026
Merged

SkipConditions: join multiple skip messages#21708
MikeMcQuaid merged 7 commits into
Homebrew:mainfrom
rexmhall09:main

Conversation

@rexmhall09

Copy link
Copy Markdown
Contributor

Join multiple skip messages with ", " instead of displaying only the first
message. This ensures all skip reasons are shown when multiple apply
(e.g. "Not maintained, Archived upstream").

Also update the output formatting for both skipped and non-skipped
statuses to improve consistency.

A test was added to verify that multiple skip messages are joined and
displayed correctly.

Codex was used to help speed up implementing the change and drafting the
update. The code and tests were manually reviewed and verified locally,
and brew lgtm was run to ensure all checks pass (on my machine).

(this is a slightly new version of a pull request I just closed with a few fixes)

Join multiple skip messages with ", " and print the combined string instead of only the first message. Update output formatting for both skipped and non-skipped statuses and add a test to verify multiple messages are displayed (e.g. "Not maintained, Archived upstream").
Add an expectation to livecheck skip_conditions spec to verify print_skip_information outputs combined error messages to stdout (and nothing to stderr) for status "error". Also add parallel_runtime_rspec.log containing the recorded test runtime for the spec.
Copilot AI review requested due to automatic review settings March 10, 2026 23:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves livecheck skip/error output so that when multiple messages are present, all reasons are displayed (comma-separated) instead of only the first message, and adds a spec to cover the joined-message behavior.

Changes:

  • Join multiple :messages entries with ", " when printing skip/error information.
  • Update print_skip_information output to use the joined message string for both skipped and non-skipped statuses.
  • Add RSpec coverage for multi-message output formatting.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
Library/Homebrew/livecheck/skip_conditions.rb Joins multiple messages and prints the combined output.
Library/Homebrew/test/livecheck/skip_conditions_spec.rb Adds tests asserting multi-message output is printed correctly.
Library/Homebrew/tests/parallel_runtime_rspec.log Adds a runtime log artifact (appears unrelated to functional changes).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@samford samford left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the author of this code, I considered joining multiple messages (albeit, using a semicolon because messages may contain a comma) but I decided to leave it unimplemented until there was a demonstrated need. This wasn't a firm TODO but more of a reminder for myself that this is a limitation of the current approach, so I should have used NOTE instead.

Could you provide an example from a formula or cask where there's more than one skip message and the existing approach isn't sufficient?

@rexmhall09

Copy link
Copy Markdown
Contributor Author

@samford

Thanks for your comment!

I am unaware of a current formula or cask producing multiple skip messages, but messages is already modeled as an array in the skip hash. Joining them helps future-proof the behavior so it won’t need to be revisited if multiple messages are returned later.

I definitely see the argument for a semicolon as the delimiter, I used a comma as that was the first thing I thought of.

Honestly, I mainly noticed the TODO comment about multiple messages and figured implementing it would be a small improvement.

@samford samford changed the title join multiple skip messages and improve output formatting SkipConditions: join multiple skip messages Mar 11, 2026

@samford samford left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking through the SkipConditions methods, I'm remembering that none of them provide more than one message (it's either one or none). I originally chose to use an array for messages (rather than a string) in case we ever needed to have more than one message but it hasn't been necessary in the five years since then. [I probably should have started with a string and only changed it to an array when it became necessary.]

I was waiting for a skip method to provide more than one message before implementing this but we already use [:messages].join in brew bump, so there's no harm in doing the same in print_skip_information.


Please make the following changes:

  • The test cases have been placed in the "when a formula has a livecheck block containing skip" context but it's not possible to have multiple messages from a skip call in a livecheck block. These test cases should be placed in a separate context after this one (e.g., context "when a formula produces multiple messages").
  • In existing tests, we store the arguments in status_hashes, so the new tests should use the same approach. You can place the new hashes after the existing skip_with_message hashes.
  • Let's use generic "First message" and "Second message" strings (and "First error" and "Second error" for the error strings), as this is currently a hypothetical scenario and there aren't defined strings to use in this context. This will limit unnecessary detail that could confuse readers into thinking that we're testing something specific.

This will need to be duplicated for casks (i.e., skip and error hashes in status_hashes[:cask] and a context "when a cask produces multiple messages" block [with similar tests] placed after the existing "when the cask has a livecheck block containing skip" context).

Comment thread Library/Homebrew/livecheck/skip_conditions.rb Outdated
Comment thread Library/Homebrew/test/livecheck/skip_conditions_spec.rb Outdated
Comment thread Library/Homebrew/test/livecheck/skip_conditions_spec.rb Outdated
Comment thread Library/Homebrew/tests/parallel_runtime_rspec.log Outdated
rexmhall09 and others added 5 commits March 10, 2026 22:28
Co-authored-by: Sam Ford <1584702+samford@users.noreply.github.com>
Co-authored-by: Sam Ford <1584702+samford@users.noreply.github.com>
Co-authored-by: Sam Ford <1584702+samford@users.noreply.github.com>
Update livecheck skip_conditions spec to cover cases with multiple messages. Added skip_with_messages and error_with_messages status hashes for both formula and cask, plus new contexts that assert printed output joins messages with "; " for skipped and error statuses. Also includes minor whitespace/formatting adjustments in the spec file.
@rexmhall09
rexmhall09 requested a review from samford March 11, 2026 05:51

@MikeMcQuaid MikeMcQuaid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@MikeMcQuaid
MikeMcQuaid added this pull request to the merge queue Mar 11, 2026
Merged via the queue into Homebrew:main with commit 9c101c4 Mar 11, 2026
36 checks passed
@samford
samford removed their request for review March 11, 2026 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants