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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump-formula-pr: use nil?/blank?/present? in if statements #10221

Merged
merged 1 commit into from Jan 6, 2021

Conversation

SeekingMeaning
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?
  • Have you successfully run brew man locally and committed any changes?

My brain was having a hard time parsing some of these 馃槄

@BrewTestBot
Copy link
Member

Review period will end on 2021-01-05 at 23:33:09 UTC.

@BrewTestBot BrewTestBot added the waiting for feedback Merging is blocked until sufficient time has passed for review label Jan 4, 2021
formula ||= determine_formula_from_url(new_url) if new_url
raise FormulaUnspecifiedError unless formula
formula ||= determine_formula_from_url(new_url) if new_url.present?
raise FormulaUnspecifiedError if formula.nil?
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
raise FormulaUnspecifiedError if formula.nil?
raise FormulaUnspecifiedError if formula.present?

to be more properly equivalent

Copy link
Contributor Author

Choose a reason for hiding this comment

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

unless formula != if formula.present?

Did you mean blank? ?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, sorry.

@@ -153,61 +153,64 @@ def bump_formula_pr

requested_spec = :stable
formula_spec = formula.stable
odie "#{formula}: no #{requested_spec} specification found!" unless formula_spec
odie "#{formula}: no #{requested_spec} specification found!" if formula_spec.nil?
Copy link
Member

Choose a reason for hiding this comment

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

Another one I'd suggest just changing to present? In general I'd say always use present? or blank? unless you're wanting to handle nil differently to false.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is also a former unless statement

Copy link
Member

Choose a reason for hiding this comment

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

Yes, sorry.

@BrewTestBot BrewTestBot removed the waiting for feedback Merging is blocked until sufficient time has passed for review label Jan 6, 2021
@BrewTestBot
Copy link
Member

Review period ended.

@MikeMcQuaid MikeMcQuaid merged commit 482dada into Homebrew:master Jan 6, 2021
@MikeMcQuaid
Copy link
Member

Thanks @SeekingMeaning!

@SeekingMeaning SeekingMeaning mentioned this pull request Jan 10, 2021
8 tasks
@BrewTestBot BrewTestBot added the outdated PR was locked due to age label Feb 5, 2021
@Homebrew Homebrew locked as resolved and limited conversation to collaborators Feb 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants