Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information