Merged
Conversation
- repair cmd/audit
MikeMcQuaid
reviewed
Apr 11, 2023
Library/Homebrew/dev-cmd/audit.rb
Outdated
| Cask::Cmd::Audit.audit_casks( | ||
| *audit_casks, | ||
| download: nil, | ||
| options = { |
Member
There was a problem hiding this comment.
Can these get passed through directly as named parameters rather than an options hash? Thanks!
MikeMcQuaid
reviewed
Apr 12, 2023
Library/Homebrew/dev-cmd/audit.rb
Outdated
Comment on lines
251
to
270
| [cask.sourcefile_path, { errors: Cask::Auditor.audit( | ||
| cask, | ||
| # For switches, we add `|| nil` so that `nil` will be passed | ||
| # instead of `false` if they aren't set. | ||
| # This way, we can distinguish between "not set" and "set to false". | ||
| audit_download: nil, | ||
| audit_online: (args.online? || nil), | ||
| audit_strict: (args.strict? || nil), | ||
|
|
||
| # No need for `|| nil` for `--[no-]signing` | ||
| # because boolean switches are already `nil` if not passed | ||
| audit_signing: args.signing?, | ||
| audit_new_cask: (args.new_cask? || nil), | ||
| audit_token_conflicts: (args.token_conflicts? || nil), | ||
| quarantine: true, | ||
| language: nil, | ||
| any_named_args: !no_named_args, | ||
| only: args.only, | ||
| except: args.except, | ||
| ), warnings: [] }] |
Member
There was a problem hiding this comment.
Suggested change
| [cask.sourcefile_path, { errors: Cask::Auditor.audit( | |
| cask, | |
| # For switches, we add `|| nil` so that `nil` will be passed | |
| # instead of `false` if they aren't set. | |
| # This way, we can distinguish between "not set" and "set to false". | |
| audit_download: nil, | |
| audit_online: (args.online? || nil), | |
| audit_strict: (args.strict? || nil), | |
| # No need for `|| nil` for `--[no-]signing` | |
| # because boolean switches are already `nil` if not passed | |
| audit_signing: args.signing?, | |
| audit_new_cask: (args.new_cask? || nil), | |
| audit_token_conflicts: (args.token_conflicts? || nil), | |
| quarantine: true, | |
| language: nil, | |
| any_named_args: !no_named_args, | |
| only: args.only, | |
| except: args.except, | |
| ), warnings: [] }] | |
| errors = Cask::Auditor.audit( | |
| cask, | |
| # For switches, we add `|| nil` so that `nil` will be passed | |
| # instead of `false` if they aren't set. | |
| # This way, we can distinguish between "not set" and "set to false". | |
| audit_download: nil, | |
| audit_online: (args.online? || nil), | |
| audit_strict: (args.strict? || nil), | |
| # No need for `|| nil` for `--[no-]signing` | |
| # because boolean switches are already `nil` if not passed | |
| audit_signing: args.signing?, | |
| audit_new_cask: (args.new_cask? || nil), | |
| audit_token_conflicts: (args.token_conflicts? || nil), | |
| quarantine: true, | |
| language: nil, | |
| any_named_args: !no_named_args, | |
| only: args.only, | |
| except: args.except, | |
| ) | |
| [cask.sourcefile_path, errors] |
bit nicer to do this outside the array and warnings are never used any more so nicer to strip them out
| end | ||
| end | ||
|
|
||
| failed_casks = cask_results.reject { |_, result| result[:errors].empty? } |
Member
There was a problem hiding this comment.
Suggested change
| failed_casks = cask_results.reject { |_, result| result[:errors].empty? } | |
| failed_casks = cask_results.reject { |_, errors| errors.empty? } |
below here: all references to result[:warnings] can be removed and result[: errors] replaced with just result/errors because, if you apply suggestions above, warnings is never set/used and errors is the hash value.
Member
There was a problem hiding this comment.
Hurray, this was a TODO that I wrote a note about in 8319c8f so it's great if this gets done.
c84684c to
b8f1830
Compare
Library/Homebrew/dev-cmd/audit.rb
Outdated
| audit_new_cask: (args.new_cask? || nil), | ||
| audit_token_conflicts: (args.token_conflicts? || nil), | ||
| quarantine: true, | ||
| language: nil, |
Member
There was a problem hiding this comment.
Do we need to pass this explicitly as nil?
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
brew stylewith your changes locally?brew typecheckwith your changes locally?brew testswith your changes locally?remove
cask/cmd/auditbecause of #14799