module RuboCop::Cop::HashTransformMethod
def handle_possible_offense(node, match, match_desc)
def handle_possible_offense(node, match, match_desc) captures = extract_captures(match) # If key didn't actually change either, this is most likely a false # positive (receiver isn't a hash). return if captures.noop_transformation? # Can't `transform_keys` if key transformation uses value, or # `transform_values` if value transformation uses key. return if captures.transformation_uses_both_args? message = "Prefer `#{new_method_name}` over `#{match_desc}`." add_offense(node, message: message) do |corrector| correction = prepare_correction(node) execute_correction(corrector, node, correction) end end