-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Add URL fallbacks for deprecated formula and cask checks #21198
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -712,26 +712,53 @@ def check_deprecated_disabled | |||||||||||||||||
| deprecated_or_disabled += Formula.installed.select(&:disabled?) | ||||||||||||||||||
| return if deprecated_or_disabled.empty? | ||||||||||||||||||
|
|
||||||||||||||||||
| formula_lines = deprecated_or_disabled.sort_by(&:full_name).uniq.map do |f| | ||||||||||||||||||
| url = f.homepage.presence || f.head&.url.presence || formula_tap_url(f) | ||||||||||||||||||
| url ? "#{f.full_name} (#{Formatter.url(url)})" : f.full_name | ||||||||||||||||||
| end | ||||||||||||||||||
|
|
||||||||||||||||||
| <<~EOS | ||||||||||||||||||
| Some installed formulae are deprecated or disabled. | ||||||||||||||||||
| You should find replacements for the following formulae: | ||||||||||||||||||
| #{deprecated_or_disabled.sort_by(&:full_name).uniq * "\n "} | ||||||||||||||||||
| #{formula_lines.join("\n ")} | ||||||||||||||||||
| EOS | ||||||||||||||||||
| end | ||||||||||||||||||
|
|
||||||||||||||||||
| 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
+727
to
+735
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||
| sig { returns(T.nilable(String)) } | ||||||||||||||||||
| def check_cask_deprecated_disabled | ||||||||||||||||||
| deprecated_or_disabled = Cask::Caskroom.casks.select(&:deprecated?) | ||||||||||||||||||
| deprecated_or_disabled += Cask::Caskroom.casks.select(&:disabled?) | ||||||||||||||||||
| return if deprecated_or_disabled.empty? | ||||||||||||||||||
|
|
||||||||||||||||||
| cask_lines = deprecated_or_disabled.sort_by(&:token).uniq.map do |c| | ||||||||||||||||||
| url = c.homepage.presence || cask_tap_url(c) | ||||||||||||||||||
| url ? "#{c.token} (#{Formatter.url(url)})" : c.token | ||||||||||||||||||
|
Comment on lines
+743
to
+744
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @MikeMcQuaid If all of them have homepages, why do we check for
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @seivan broken or non-homebrew core formulae may not.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||||||||||||||||||
| end | ||||||||||||||||||
|
|
||||||||||||||||||
| <<~EOS | ||||||||||||||||||
| Some installed casks are deprecated or disabled. | ||||||||||||||||||
| You should find replacements for the following casks: | ||||||||||||||||||
| #{deprecated_or_disabled.sort_by(&:token).uniq * "\n "} | ||||||||||||||||||
| #{cask_lines.join("\n ")} | ||||||||||||||||||
| EOS | ||||||||||||||||||
| end | ||||||||||||||||||
|
|
||||||||||||||||||
| 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
+754
to
+760
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||
|
|
||||||||||||||||||
| sig { returns(T.nilable(String)) } | ||||||||||||||||||
| def check_git_status | ||||||||||||||||||
| return unless Utils::Git.available? | ||||||||||||||||||
|
|
||||||||||||||||||
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.