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

cask/info: send missing args after removing openstruct #18917

Merged
merged 2 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Library/Homebrew/cask/info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
output
end

sig { params(cask: Cask).void }
def self.info(cask)
sig { params(cask: Cask, args: Homebrew::Cmd::Info::Args).void }
def self.info(cask, args:)

Check warning on line 35 in Library/Homebrew/cask/info.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/cask/info.rb#L34-L35

Added lines #L34 - L35 were not covered by tests
puts get_info(cask)

require "utils/analytics"
::Utils::Analytics.cask_output(cask, args: Homebrew::CLI::Args.new)
::Utils::Analytics.cask_output(cask, args:)

Check warning on line 39 in Library/Homebrew/cask/info.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/cask/info.rb#L39

Added line #L39 was not covered by tests
Comment on lines -39 to +40
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe this was an existing bug that only came to light because of recent changes. It seems like by creating a new instance of the CLI args here that args.analytics? would always be falsey later on which doesn't seem to be the desired behavior. Now when the --analytics flag is set it will get passed to Utils::Analytics.cask_output the same way it already gets passed to Utils::Analytics.formula_output.

Copy link
Member

Choose a reason for hiding this comment

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

Nice work! We might want to add some guardrails around where/how Args can be instantiated 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

IMO it's probably not necessary unless it's really simple to implement since I doubt that we'll ever run into the same problem again.

end

sig { params(cask: Cask).returns(String) }
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/cmd/info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@
def info_cask(cask)
require "cask/info"

Cask::Info.info(cask)
Cask::Info.info(cask, args:)

Check warning on line 385 in Library/Homebrew/cmd/info.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/cmd/info.rb#L385

Added line #L385 was not covered by tests
end
end
end
Expand Down
Loading