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 <michael@michaelcho.dev>
This commit is contained in:
parent
ad196e057b
commit
747e95b159
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user