Class: RuboCop::Cop::Cask::UninstallMethodsOrder Private
- Extended by:
- AutoCorrector
- Includes:
- HelperFunctions
- Defined in:
- rubocops/cask/uninstall_methods_order.rb
Overview
This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.
This cop checks for the correct order of methods within the 'uninstall' and 'zap' stanzas and validates related metadata.
Constant Summary collapse
- MSG =
This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.
T.let("`%<method>s` method out of order", String)
- METADATA_KEYS =
This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.
These keys are ignored when checking method order. Mirrors AbstractUninstall::METADATA_KEYS.
T.let( [:on_upgrade].freeze, T::Array[Symbol], )
- USELESS_METADATA_MSG =
This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.
T.let( "`on_upgrade` has no effect without matching `uninstall quit:` or `uninstall signal:` directives", String, )
- PARTIAL_METADATA_MSG =
This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.
T.let( "`on_upgrade` lists %<symbols>s without matching `uninstall` directives", String, )
Instance Method Summary collapse
- #on_send(node) ⇒ void private
Methods included from HelperFunctions
#block_method_called_in_block?, #block_size, #check_precedence, #class_name, #component_precedes?, #end_column, #expression_negated?, #find_all_blocks, #find_block, #find_blocks, #find_const, #find_every_func_call_by_name, #find_every_method_call_by_name, #find_instance_call, #find_instance_method_call, #find_method_calls_by_name, #find_method_def, #find_method_with_args, #find_node_method_by_name, #find_strings, #format_component, #line_number, #line_start_column, #method_called?, #method_called_ever?, #method_name, #node_equals?, #offending_node, #parameters, #parameters_passed?, #problem, #regex_match_group, #size, #source_buffer, #start_column, #string_content
Instance Method Details
#on_send(node) ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
This method returns an undefined value.
35 36 37 38 39 40 41 42 43 44 45 |
# File 'rubocops/cask/uninstall_methods_order.rb', line 35 def on_send(node) return unless [:zap, :uninstall].include?(node.method_name) hash_node = node.arguments.first return if hash_node.nil? || (!hash_node.is_a?(AST::Node) && !hash_node.hash_type?) comments = processed_source.comments check_ordering(hash_node, comments) (hash_node, comments) end |