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

Fixed type error in 'brew audit' #14808

Merged
merged 1 commit into from Feb 27, 2023
Merged

Conversation

dduugg
Copy link
Sponsor Member

@dduugg dduugg commented Feb 25, 2023

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

Resolves:

$ brew audit --eval-all                                                                                           [master|⚑6]
vde:
  * fully scope test system calls, e.g. system "#{bin}/vde_switch"
Error: Return value: Expected type String, got type NilClass
Caller: /opt/homebrew/Library/Homebrew/cask/auditor.rb:68
Definition: /opt/homebrew/Library/Homebrew/cask/audit.rb:123
Please report this issue:
  https://docs.brew.sh/Troubleshooting
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/sorbet-runtime-0.5.10461/lib/types/configuration.rb:296:in `call_validation_error_handler_default'
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/sorbet-runtime-0.5.10461/lib/types/configuration.rb:303:in `call_validation_error_handler'
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/sorbet-runtime-0.5.10461/lib/types/private/methods/call_validation.rb:187:in `report_error'
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/sorbet-runtime-0.5.10461/lib/types/private/methods/call_validation.rb:166:in `validate_call'
/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/sorbet-runtime-0.5.10461/lib/types/private/methods/_methods.rb:270:in `block in _on_method_added'
/opt/homebrew/Library/Homebrew/cask/auditor.rb:68:in `audit'
/opt/homebrew/Library/Homebrew/cask/auditor.rb:12:in `audit'
/opt/homebrew/Library/Homebrew/cask/cmd/audit.rb:115:in `block in audit_casks'
/opt/homebrew/Library/Homebrew/cask/cmd/audit.rb:113:in `to_h'
/opt/homebrew/Library/Homebrew/cask/cmd/audit.rb:113:in `audit_casks'
/opt/homebrew/Library/Homebrew/dev-cmd/audit.rb:239:in `audit'
/opt/homebrew/Library/Homebrew/brew.rb:93:in `<main>'

(I made the other necessary changes in oder to enable typed: true, which I consider to be a form of writing new tests, so I'm checking that box 😄)

@BrewTestBot
Copy link
Member

Review period will end on 2023-02-28 at 00:00:00 UTC.

@BrewTestBot BrewTestBot added the waiting for feedback Merging is blocked until sufficient time has passed for review label Feb 25, 2023
@dduugg dduugg added the critical Critical change which should be shipped as soon as possible. label Feb 25, 2023
@BrewTestBot BrewTestBot removed the waiting for feedback Merging is blocked until sufficient time has passed for review label Feb 25, 2023
@BrewTestBot
Copy link
Member

Review period skipped due to critical label.

@@ -528,7 +527,7 @@ def audit_signing
end
end

sig { returns(T.nilable(T.any(T::Boolean, Symbol))) }
sig { returns(T.any(NilClass, T::Boolean, Symbol)) }
Copy link
Sponsor Member Author

@dduugg dduugg Feb 25, 2023

Choose a reason for hiding this comment

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

This is equivalent but marginally more readable imo (one fewer nesting of parens)

Copy link
Member

@Bo98 Bo98 Feb 25, 2023

Choose a reason for hiding this comment

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

This sort of weird multi-typing is probably something to address at some point (what's the difference between nil and false? when is true returned over Symbol?). Cask is littered with it so it's a big task to clean up everywhere.

There's a lot of nilable boolean stuff that is also very weird in places. It make sense for certain triple-state CLI arguments where explicit yes, explicit no and implicit default intentionally have three diferent behaviours. But some other bits I'm less sure it's necessary.

@nandahkrishna nandahkrishna changed the title Fixd type error in 'brew audit' Fixed type error in 'brew audit' Feb 25, 2023
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.

Makes sense to get to typed: true but I agree with @Bo98 that in general I think we accept/return nil way more often than we should.

@MikeMcQuaid MikeMcQuaid merged commit 5975ca9 into Homebrew:master Feb 27, 2023
@MikeMcQuaid
Copy link
Member

Thanks again @dduugg!

@dduugg dduugg deleted the audit-types branch February 27, 2023 19:02
@github-actions github-actions bot added the outdated PR was locked due to age label Mar 30, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
critical Critical change which should be shipped as soon as possible. outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants