From 747e95b1592337134967086d81d155e6541fd40a Mon Sep 17 00:00:00 2001 From: Michael Cho Date: Fri, 5 Apr 2024 10:03:35 -0400 Subject: [PATCH] rubocops/resource_requires_dependencies: check `sym_type?` Avoid running `#value` on unsupported types by selecting only symbol nodes as we only care about `:build` value. Signed-off-by: Michael Cho --- Library/Homebrew/rubocops/resource_requires_dependencies.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/rubocops/resource_requires_dependencies.rb b/Library/Homebrew/rubocops/resource_requires_dependencies.rb index 97acab0eb9..1ddcf56111 100644 --- a/Library/Homebrew/rubocops/resource_requires_dependencies.rb +++ b/Library/Homebrew/rubocops/resource_requires_dependencies.rb @@ -27,8 +27,8 @@ module RuboCop uses_from_macos_or_depends_on = (uses_from_macos_nodes + depends_on_nodes).filter_map do |node| if (dep = node.arguments.first).hash_type? dep_types = dep.values.first - dep_types = dep_types.array_type? ? dep_types.values.map(&:value) : [dep_types.value] - dep.keys.first.str_content if dep_types.include?(:build) + dep_types = dep_types.array_type? ? dep_types.values : [dep_types] + dep.keys.first.str_content if dep_types.select(&:sym_type?).map(&:value).include?(:build) else dep.str_content end