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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable strict typing in Formula #19323

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

Enable strict typing in Formula #19323

wants to merge 4 commits into from

Conversation

dduugg
Copy link
Member

@dduugg dduugg commented Feb 17, 2025

  • 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?

@dduugg dduugg marked this pull request as draft February 17, 2025 22:15
@dduugg dduugg force-pushed the typed-formula branch 8 times, most recently from 84d35c8 to 0fa08df Compare February 17, 2025 23:34
Copy link
Member

@p-linnane p-linnane left a comment

Choose a reason for hiding this comment

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

😍

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.

Looks good to me once 🟢! Feels almost certain to go 💥 a bit after merge so let's wait until not too near to a (Monday, usually) release tag and be around for a few hours "babysitting" if possible 🙇🏻

The only (optional/non-blocking) preference I'd have here is to use T.must less and instead do e.g. local assignment and early returns because it's a bit more clear and nicer, in my opinion.

@@ -249,7 +249,7 @@ def self.run_checks(
# comparison.
current = if formula
if formula.head_only?
Version.new(formula.any_installed_version.version.commit)
Version.new(T.must(T.must(formula.any_installed_version).version.commit))
Copy link
Member

@samford samford Feb 19, 2025

Choose a reason for hiding this comment

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

I opened #19338 to account for these nilable values instead of using T.must. It also adds type signatures to related methods in the process, so brew typecheck will identify this issue as expected (shout if any of it conflicts with this PR).

Edit: Now merged, so this can be addressed in a rebase.

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.

4 participants