Skip to content

remove cask/cmd/audit#15201

Merged
MikeMcQuaid merged 6 commits intoHomebrew:masterfrom
hyuraku:remove_cask/cmd/audit
Apr 19, 2023
Merged

remove cask/cmd/audit#15201
MikeMcQuaid merged 6 commits intoHomebrew:masterfrom
hyuraku:remove_cask/cmd/audit

Conversation

@hyuraku
Copy link
Contributor

@hyuraku hyuraku commented Apr 11, 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?

remove cask/cmd/audit because of #14799

- repair cmd/audit
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.

Great work so far!

Cask::Cmd::Audit.audit_casks(
*audit_casks,
download: nil,
options = {
Copy link
Member

Choose a reason for hiding this comment

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

Can these get passed through directly as named parameters rather than an options hash? Thanks!

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: [] }]
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
[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? }
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
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.

Copy link
Member

Choose a reason for hiding this comment

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

Hurray, this was a TODO that I wrote a note about in 8319c8f so it's great if this gets done.

Copy link
Member

Choose a reason for hiding this comment

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

@hyuraku nudge on this!

Copy link
Member

Choose a reason for hiding this comment

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

Opened #15269 for this.

@hyuraku hyuraku force-pushed the remove_cask/cmd/audit branch from c84684c to b8f1830 Compare April 12, 2023 13:23
audit_new_cask: (args.new_cask? || nil),
audit_token_conflicts: (args.token_conflicts? || nil),
quarantine: true,
language: nil,
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to pass this explicitly as nil?

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.

Thanks @hyuraku!

@MikeMcQuaid MikeMcQuaid merged commit 0b4c035 into Homebrew:master Apr 19, 2023
@MikeMcQuaid MikeMcQuaid mentioned this pull request Apr 19, 2023
7 tasks
@dduugg dduugg mentioned this pull request Apr 19, 2023
7 tasks
@github-actions github-actions bot added the outdated PR was locked due to age label May 20, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 20, 2023
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.

4 participants