Skip to content

Conversation

botantony
Copy link
Contributor

  • 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 style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

Signed-off-by: botantony <antonsm21@gmail.com>
@MikeMcQuaid
Copy link
Member

@botantony Can you fill out more details in the issue body and/or a comment e.g. how you noticed this, how this affects users as-is, etc.

@botantony
Copy link
Contributor Author

This affects users who want to audit and use FromAPILoader formula loader. Right now, most formula loaders correctly distinguish whether no_autobump! uses a string or a symbol. I might've fixed it in the auditor by checking if the reason is a symbol there, but I decided to move it to the formulary class for consistency

Plus, this is the way FromAPILoader deals with deprecate!/disable! reasons (which is very similar to this case):

if (deprecation_date = json_formula["deprecation_date"].presence)
reason = DeprecateDisable.to_reason_string_or_symbol json_formula["deprecation_reason"], type: :formula
deprecate! date: deprecation_date, because: reason
end
if (disable_date = json_formula["disable_date"].presence)
reason = DeprecateDisable.to_reason_string_or_symbol json_formula["disable_reason"], type: :formula
disable! date: disable_date, because: reason
end

sig { params(string: T.nilable(String), type: Symbol).returns(T.nilable(T.any(String, Symbol))) }
def to_reason_string_or_symbol(string, type:)
return if string.nil?
if (type == :formula && FORMULA_DEPRECATE_DISABLE_REASONS.key?(string.to_sym)) ||
(type == :cask && CASK_DEPRECATE_DISABLE_REASONS.key?(string.to_sym))
return string.to_sym
end
string
end

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.

Ok, thanks for the PR and for explaining! In future: please fill out the issue body and check the boxes.

@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue Jul 18, 2025
Merged via the queue into Homebrew:main with commit f5f64ce Jul 18, 2025
36 checks passed
@botantony botantony deleted the formulary_no_autobump branch July 18, 2025 16:48
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