From d9b376a9cdba1b889a998a513af7f4bab49911ae Mon Sep 17 00:00:00 2001 From: Issy Long Date: Sun, 9 Feb 2025 18:33:12 +0000 Subject: [PATCH 1/2] rubocops/lines: Clean up an old TODO - I considered writing a cop for this, but it's not worth it: there are no `[:test, :build]` occurrences in Core and this Rust rule only applies in Core formulae. --- Library/Homebrew/rubocops/lines.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Library/Homebrew/rubocops/lines.rb b/Library/Homebrew/rubocops/lines.rb index 599e31d650..638dac4409 100644 --- a/Library/Homebrew/rubocops/lines.rb +++ b/Library/Homebrew/rubocops/lines.rb @@ -938,9 +938,7 @@ module RuboCop end end - # TODO: Enforce order of dependency types so we don't need to check for - # depends_on "rustup" => [:test, :build] - [:build, [:build, :test], [:test, :build]].each do |type| + [:build, [:build, :test]].each do |type| find_method_with_args(body_node, :depends_on, "rustup" => type) do problem "Formulae in homebrew/core should use 'depends_on \"rust\" => #{type}' " \ "instead of '#{@offensive_node.source}'." do |corrector| From 9359292db0f1ba8c20993cf130b3f2417f109adf Mon Sep 17 00:00:00 2001 From: Issy Long Date: Tue, 11 Feb 2025 10:28:52 +0000 Subject: [PATCH 2/2] Retain the mis-ordered dependency case. Co-authored-by: Carlo Cabrera --- Library/Homebrew/rubocops/lines.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/rubocops/lines.rb b/Library/Homebrew/rubocops/lines.rb index 638dac4409..579efd258a 100644 --- a/Library/Homebrew/rubocops/lines.rb +++ b/Library/Homebrew/rubocops/lines.rb @@ -938,7 +938,7 @@ module RuboCop end end - [:build, [:build, :test]].each do |type| + [:build, [:build, :test], [:test, :build]].each do |type| find_method_with_args(body_node, :depends_on, "rustup" => type) do problem "Formulae in homebrew/core should use 'depends_on \"rust\" => #{type}' " \ "instead of '#{@offensive_node.source}'." do |corrector|