Skip to content

Audit cask flight step conversions#22411

Draft
MikeMcQuaid wants to merge 1 commit into
mainfrom
install-steps-cask-audit
Draft

Audit cask flight step conversions#22411
MikeMcQuaid wants to merge 1 commit into
mainfrom
install-steps-cask-audit

Conversation

@MikeMcQuaid
Copy link
Copy Markdown
Member

@MikeMcQuaid MikeMcQuaid commented May 24, 2026

Blocked until next release.

  • Keep tap-wide conversion checks separate from the cask DSL change.
  • Encourage *_steps only when legacy *flight blocks are simple.
  • Match literal file-preparation calls that the step runner can model.

  • 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? Performance claims (e.g. "this is faster") must include Hyperfine benchmarks.
  • Have you written new tests (excluding integration tests) for your changes? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) with your changes locally?

  • AI was used to generate or assist with generating this PR.

OpenAI Codex 5.5 xhigh with local review and testing.


- Keep tap-wide conversion checks separate from the cask DSL change.
- Encourage `*_steps` only when legacy `*flight` blocks are simple.
- Match literal file-preparation calls that the step runner can model.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances the RuboCop::Cop::Cask::InstallSteps cop to automatically convert “simple” legacy flight blocks (e.g., postflight do ... end) into the declarative *_steps DSL when the block consists solely of file-preparation operations that the steps runner can model.

Changes:

  • Enable autocorrection for simple flight blocks by adding an audit_flight_block path when a matching *_steps stanza is not already present.
  • Implement an autocorrect that rewrites eligible flight blocks into the corresponding *_steps block using the shared install-step conversion helper.
  • Update/add RuboCop spec coverage to assert both the offense and the expected corrected source, and ensure non-file-prep flight blocks are not autocorrected.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
Library/Homebrew/rubocops/cask/install_steps.rb Adds AutoCorrector support and converts simple pre/post/uninstall_*flight blocks into *_steps via shared conversion helpers.
Library/Homebrew/test/rubocops/cask/install_steps_spec.rb Updates the spec to expect an offense + autocorrection for simple file-prep postflight blocks and keeps a negative case for non-file-prep blocks.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants