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

tests: enable brew style in linters #1354

Merged
merged 3 commits into from
Aug 21, 2024
Merged

Conversation

mistydemeo
Copy link
Contributor

@mistydemeo mistydemeo commented Aug 21, 2024

This adds a brew style linter to make sure that our generated Homebrew formulas will pass Homebrew's brew style for users who have enabled Homebrew's default CI setup for their taps. I've also ensured our snapshots contain the auto-restyled copies after brew style --fix is run.

This required one stylistic change: the hashmap for binary aliases would violate the line length lint, and unfortunately Rubocop's line length autoformatter was consistently getting the formatting wrong. This instead (ab)uses the fact that JSON hashmaps have a compatible syntax to Ruby 1.9+ hashmaps so long as symbols are the keys - and we were already using symbolized keys. We can therefore use jinja's tojson with an indent to enable pretty-printing.

@mistydemeo
Copy link
Contributor Author

Removed the restyled copies from the snapshots. It broke Linux and Windows, which don't have the ability to run brew style --fix.

This adds a `brew style` linter to make sure that our generated Homebrew
formulas will pass Homebrew's `brew style` for users who have enabled Homebrew's
default CI setup for their taps. I've also ensured our snapshots contain the
auto-restyled copies after `brew style --fix` is run.

This required one stylistic change: the hashmap for binary aliases would
violate the line length lint, and unfortunately Rubocop's line length autoformatter
was consistently getting the formatting wrong. This instead (ab)uses the fact that
JSON hashmaps have a compatible syntax to Ruby 1.9+ hashmaps so long as symbols
are the keys - and we were already using symbolized keys. The resulting hashmap
is slightly strange-looking by Ruby standards, since symbolized keys usually aren't
quoted, but Rubocop isn't mad about it.
@mistydemeo mistydemeo force-pushed the homebrew_style_lint_tests branch 3 times, most recently from 6d7a8d8 to bcfd4a2 Compare August 21, 2024 19:58
@mistydemeo mistydemeo merged commit 921905e into main Aug 21, 2024
16 checks passed
@mistydemeo mistydemeo deleted the homebrew_style_lint_tests branch August 21, 2024 20:45
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