Skip to content

Type brew audit options instead of **options - #24523

Merged
dduugg merged 1 commit into
Homebrew:mainfrom
dduugg:audit-typed-options
Nov 7, 2026
Merged

dduugg merged 1 commit into
Homebrew:mainfrom
dduugg:audit-typed-options

Conversation

@dduugg

@dduugg dduugg commented Nov 7, 2026

Copy link
Copy Markdown
Member
  • Pass explicit keywords to FormulaAuditor.new and Style.check_style_json so brew typecheck catches a mistyped keyword. .compact and keys added after the hash literal hid them from Sorbet, so a typo only failed at runtime.
  • Drop FormulaAuditor's display_cop_names:, which nothing has passed since --display-cop-names became a hidden no-op.
  • Cover the cops that --only-cops, --except-cops, --new and --strict select in unit tests.

  • Have you followed our Contributing guidelines?
  • Have you checked for other open Pull Requests for the same change?
  • Have you explained what your changes do? Performance claims (e.g. "this is faster") must include brew benchmark results.
  • Have you explained why you'd like these changes included, not just what they do?
  • For bug fixes, have you given step-by-step brew commands to reproduce the bug?
  • Have you written new tests (excluding integration tests)? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) locally?

  • I did not use AI/LLM to create this PR, or I disclosed the tool/model below and reviewed its output; I did not attribute commits to AI and will answer maintainer questions and review comments myself without AI/LLM.

Claude Code with Opus 5.5, with local review and testing.


- `FormulaAuditor.new` and `Style.check_style_json` were called with
  splatted hashes. `.compact` erased the formula hash's shape and the
  cop keys were added after the literal, so Sorbet checked neither and
  a mistyped keyword would only fail at runtime.
- `.compact` was a no-op: every Boolean is non-nil and `only`, `except`
  and `style_offenses` already default to `nil`.
- `--only-cops`, `--new`, `--except-cops` and `--strict` still select
  the same cops as before, now covered by `dev-cmd/audit_spec.rb`.
- Drop `FormulaAuditor`'s `display_cop_names:` keyword: nothing has
  passed it since `--display-cop-names` became a hidden no-op in 2023.
@coderabbitai

coderabbitai Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Bug Fixes
    • Formula style audits now respect the selected checks and exclusions across default, strict, new-formula, and explicit cop-selection options.
    • Style-audit findings now show the offense message without a cop-name prefix, making the reported issue more direct.

The audit command now selects and passes style cop options directly. FormulaAuditor no longer accepts display_cop_names and reports offense messages without cop-name prefixes.

Changes: Formula style audit

Layer / File(s) Summary
Cop option selection and forwarding
Library/Homebrew/dev-cmd/audit.rb, Library/Homebrew/test/dev-cmd/audit_spec.rb
Audit#run selects cop exclusions based on the audit flags and passes style options directly to Style.check_style_json. Tests cover default, strict, new, only-cop and except-cop cases.
Formula auditor style reporting
Library/Homebrew/formula_auditor.rb
FormulaAuditor removes the display_cop_names option. audit_style passes each offense message to problem without a cop-name prefix.
Merge Risk: Minimal · up to 0907f

The reviewed changes preserve cop-selection behavior, and no actionable merge-blocking risk remains after normal checks.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title describes the main change: passing explicit brew audit options for type checking.
Description check Passed The description covers explicit keywords, removal of display_cop_names:, and cop selection tests.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d8d6b723-b4e0-4383-8cd8-a4cbca35da11
Commits

Reviewing files that changed from the base of the PR and between 650524b and 0907fa8.

Files selected for processing: 3

  • Library/Homebrew/dev-cmd/audit.rb
  • Library/Homebrew/formula_auditor.rb
  • Library/Homebrew/test/dev-cmd/audit_spec.rb

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@MikeMcQuaid MikeMcQuaid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Much nicer thanks!

@dduugg
dduugg added this pull request to the merge queue Nov 7, 2026
Merged via the queue into Homebrew:main with commit 3ccfa1d Nov 7, 2026
56 checks passed
@dduugg
dduugg deleted the audit-typed-options branch November 7, 2026 16:33
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

⌂ 换网址