Check dependency order in on_system methods

This commit is contained in:
fn ⌃ ⌥ 2022-08-02 21:56:45 -07:00
parent cb4ac65f26
commit d5f949e60b
3 changed files with 7 additions and 7 deletions

View File

@ -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)

View File

@ -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

View File

@ -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