Skip to content
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

livecheck: error on invalid url symbol #18622

Merged
merged 2 commits into from
Oct 26, 2024

Commits on Oct 25, 2024

  1. livecheck: error on invalid url symbol

    Up to now, we haven't been accounting for `#url` symbol arguments in
    `livecheck` blocks that don't reference a checkable URL. This can
    either be an invalid symbol (e.g., using the `:stable` formula symbol
    in a cask) or a valid symbol where the referenced URL doesn't exist
    (e.g., using `:head` when there's no `head` URL). [Almost all of the
    valid symbols are required URLs but `head` is optional.]
    
    Over the years, we've had a handful of slips where we've used `:url`
    in formulae (when it's only valid in casks) and `:stable` in casks
    (when it's only valid in formulae). In this scenario,
    `livecheck_url_string` is `nil`, so livecheck falls back to
    `#checkable_urls`. In this scenario, `stable` and `url` are the first
    checkable URLs for formulae and casks (respectively), so the checks
    ended up working as expected merely by chance. This isn't obvious in
    the output and even the debug output looks normal. It only becomes
    apparent that livecheck isn't working as expected if it iterates
    through more than one checkable URL before reaching one that works
    (not the case in those instances).
    
    With that in mind, this adds an error when a `#url` symbol is used
    but it doesn't correspond to a checkable URL. This will account for
    both of the mentioned scenarios (invalid symbols and valid ones
    referencing a non-existent URL) and prevent livecheck from quietly
    proceeding in an unexpected manner.
    samford committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    d7b515b View commit details
    Browse the repository at this point in the history
  2. Expand #checkable_urls test coverage

    This expands tests for `#checkable_urls` to cover everything except
    branches that shouldn't ever be reached.
    samford committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    bfdb84f View commit details
    Browse the repository at this point in the history