From 40199404cfe26492bc24577d73b893871644c8b2 Mon Sep 17 00:00:00 2001 From: Sam Ford <1584702+samford@users.noreply.github.com> Date: Mon, 17 Oct 2022 13:22:34 -0400 Subject: [PATCH] Allow livecheck method in on_system blocks It's sometimes necessary to have a `livecheck` block in an `on_macos` or `on_linux` block. For example, a formula may be disabled on macOS but not on Linux. In that scenario, we only want a `livecheck` block to apply to Linux, so livecheck will automatically skip the formula as disabled on macOS. While this setup works on a technical level, `brew style` will give an `on_linux cannot include livecheck` offense. This commit addresses the issue by adding `livecheck` to `on_system_allowed_methods` in the `ComponentsOrder` Rubocop. This also updates `on_system_allowed_methods` to use the order in `FORMULA_COMPONENT_PRECEDENCE_LIST`, which may make it a bit easier for formula maintainers to read at a glance. --- Library/Homebrew/rubocops/components_order.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Library/Homebrew/rubocops/components_order.rb b/Library/Homebrew/rubocops/components_order.rb index 5d28a172a1..eac9cc91e7 100644 --- a/Library/Homebrew/rubocops/components_order.rb +++ b/Library/Homebrew/rubocops/components_order.rb @@ -120,14 +120,15 @@ module RuboCop end end on_system_allowed_methods = %w[ - depends_on - patch - resource - deprecate! + livecheck + keg_only disable! + deprecate! + depends_on conflicts_with fails_with - keg_only + resource + patch ignore_missing_libraries ] on_system_allowed_methods += on_system_methods.map(&:to_s)