Skip to content

Conversation

@seivan
Copy link

@seivan seivan commented Dec 9, 2025

I find it it a bit frustrating having to do a brew info on each deprecated cask or formula to investigate why things are deprecated, so it would be nice to include URLs, but I didn't want to overload the list, so it will try to pick the best URL to show with the following fallbacks:

Formulas
homepagehead.url (git repo)tap file URL

Casks
homepagetap file URL

What's the existing output?

brew doctor                  

Warning: Some installed casks are deprecated or disabled.
You should find replacements for the following casks:
  syntax-highlight 

What's the new output?

brew doctor                  

Warning: Some installed casks are deprecated or disabled.
You should find replacements for the following casks:
  syntax-highlight (https://github.com/sbarex/SourceCodeSyntaxHighlight)
  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) with your changes locally?

@seivan seivan force-pushed the feature/deprecated_url branch 2 times, most recently from ec3f2c7 to 9f91943 Compare December 9, 2025 04:02
@seivan seivan marked this pull request as ready for review December 9, 2025 04:08
Copilot AI review requested due to automatic review settings December 9, 2025 04:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds URL fallbacks to deprecated/disabled formula and cask diagnostics to help users investigate why packages are deprecated without needing to run brew info separately. The URLs are displayed inline using a prioritized fallback chain.

Key changes:

  • Added formula_tap_url and cask_tap_url helper methods to construct GitHub URLs for formula/cask files
  • Modified check_deprecated_disabled and check_cask_deprecated_disabled to include URLs in their output
  • Added comprehensive test coverage for the new helper methods and URL fallback logic

Reviewed changes

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

File Description
Library/Homebrew/diagnostic.rb Adds URL fallback logic to deprecated/disabled checks with helper methods formula_tap_url and cask_tap_url
Library/Homebrew/test/diagnostic_checks_spec.rb Adds comprehensive test coverage for the new URL helper methods and fallback behavior

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

Formulas
`homepage` → `head.url (git repo)` → `tap file URL`

Casks
`homepage` → `tap file URL`
@seivan seivan force-pushed the feature/deprecated_url branch from 9f91943 to 5ad2ae7 Compare December 9, 2025 04:41
@MikeMcQuaid
Copy link
Member

I find it it a bit frustrating having to do a brew info on each deprecated cask or formula to investigate why things are deprecated, so it would be nice to include URLs, but I didn't want to overload the list, so it will try to pick the best URL to show with the following fallbacks:

@seivan Let's step back a bit here: what problem are you trying to solve here? What's the existing output? Why don't you like that? What's the new output? What problems are solved with it?

Thanks!

@seivan
Copy link
Author

seivan commented Dec 11, 2025

@seivan Let's step back a bit here: what problem are you trying to solve here?

Access to information shouldn't take multiple steps.

What's the existing output?

brew doctor                  

Warning: Some installed casks are deprecated or disabled.
You should find replacements for the following casks:
  syntax-highlight 

Why don't you like that?

Because it doesn't tell me why or where I can find more information or alternatives without doing a brew info on each.

What's the new output?

brew doctor                  

Warning: Some installed casks are deprecated or disabled.
You should find replacements for the following casks:
  syntax-highlight (https://github.com/sbarex/SourceCodeSyntaxHighlight)

What problems are solved with it?

@MikeMcQuaid It tells me what to lookup in case I want replacements or find a reason why or other work arounds.

Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

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

All official formulae and casks have homepages so can simplify by skipping the fallbacks. Can remove any tests failing after this.

Comment on lines +716 to +717
url = f.homepage.presence || f.head&.url.presence || formula_tap_url(f)
url ? "#{f.full_name} (#{Formatter.url(url)})" : f.full_name
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
url = f.homepage.presence || f.head&.url.presence || formula_tap_url(f)
url ? "#{f.full_name} (#{Formatter.url(url)})" : f.full_name
if (homepage = f.homepage.presence)
"#{f.full_name} (#{Formatter.url(homepage)})"
else
f.full_name
end

Comment on lines +727 to +735
sig { params(formula: Formula).returns(T.nilable(String)) }
def formula_tap_url(formula)
tap = formula.tap
return if tap.blank? || tap.remote.blank?

path = formula.path.relative_path_from(tap.path)
"#{tap.remote}/blob/HEAD/#{path}"
end

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
sig { params(formula: Formula).returns(T.nilable(String)) }
def formula_tap_url(formula)
tap = formula.tap
return if tap.blank? || tap.remote.blank?
path = formula.path.relative_path_from(tap.path)
"#{tap.remote}/blob/HEAD/#{path}"
end

Comment on lines +754 to +760
sig { params(cask: Cask::Cask).returns(T.nilable(String)) }
def cask_tap_url(cask)
tap = cask.tap
return if tap.blank? || tap.remote.blank?

"#{tap.remote}/blob/HEAD/#{tap.relative_cask_path(cask.token)}"
end
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
sig { params(cask: Cask::Cask).returns(T.nilable(String)) }
def cask_tap_url(cask)
tap = cask.tap
return if tap.blank? || tap.remote.blank?
"#{tap.remote}/blob/HEAD/#{tap.relative_cask_path(cask.token)}"
end

Comment on lines +743 to +744
url = c.homepage.presence || cask_tap_url(c)
url ? "#{c.token} (#{Formatter.url(url)})" : c.token
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
url = c.homepage.presence || cask_tap_url(c)
url ? "#{c.token} (#{Formatter.url(url)})" : c.token
if (homepage = c.homepage.presence)
"#{c.token} (#{Formatter.url(homepage)})"
else
c.token
end

Copy link
Author

Choose a reason for hiding this comment

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

@MikeMcQuaid If all of them have homepages, why do we check for c.homepage.presence?

Copy link
Member

Choose a reason for hiding this comment

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

@seivan broken or non-homebrew core formulae may not.

Copy link
Author

Choose a reason for hiding this comment

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

You mean taps? I think we should keep the fallbacks in that case, a lot of people use taps. In fact I made one recently because of the gatekeeper issues. It's a diagnostic tool, it should diagnose things that are broken, no?

Copy link
Member

Choose a reason for hiding this comment

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

@seivan I don't think for this debugging tool we should handle the edge cases of "deprecated formulae in taps that fail audits and/or are otherwise broken". It's not worth the extra code.

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.

2 participants