Check dependency order in on_system methods
This commit is contained in:
parent
cb4ac65f26
commit
d5f949e60b
@ -14,12 +14,6 @@ module RuboCop
|
||||
class ComponentsOrder < FormulaCop
|
||||
extend AutoCorrector
|
||||
|
||||
def on_system_methods
|
||||
@on_system_methods ||= [:intel, :arm, :macos, :linux, :system, *MacOSVersions::SYMBOLS.keys].map do |m|
|
||||
:"on_#{m}"
|
||||
end
|
||||
end
|
||||
|
||||
def audit_formula(_node, _class_node, _parent_class_node, body_node)
|
||||
@present_components, @offensive_nodes = check_order(FORMULA_COMPONENT_PRECEDENCE_LIST, body_node)
|
||||
|
||||
|
@ -16,7 +16,7 @@ module RuboCop
|
||||
def audit_formula(_node, _class_node, _parent_class_node, body_node)
|
||||
check_dependency_nodes_order(body_node)
|
||||
check_uses_from_macos_nodes_order(body_node)
|
||||
[:head, :stable].each do |block_name|
|
||||
([:head, :stable] + on_system_methods).each do |block_name|
|
||||
block = find_block(body_node, block_name)
|
||||
next unless block
|
||||
|
||||
|
@ -198,6 +198,12 @@ module RuboCop
|
||||
|
||||
@file_path !~ Regexp.union(paths_to_exclude)
|
||||
end
|
||||
|
||||
def on_system_methods
|
||||
@on_system_methods ||= [:intel, :arm, :macos, :linux, :system, *MacOSVersions::SYMBOLS.keys].map do |m|
|
||||
:"on_#{m}"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user