class RuboCop::Cop::Lint::UnusedMethodArgument

Public Instance Methods

message(variable) click to toggle source
# File lib/rubocop/cop/lint/unused_method_argument.rb, line 7
def message(variable)
  message = String.new(
    "ζ*'ヮ')ζ<うっうー!使っていない引数がありますよー `#{variable.name}`!"
  )

  unless variable.keyword_argument?
    message << " もし使わないなら、`_`か`_#{variable.name}`のようにしましょうねー!"
  end

  scope = variable.scope
  all_arguments = scope.variables.each_value.select(&:method_argument?)

  if all_arguments.none?(&:referenced?)
    message << ' 引数がなんでもいいなら、' \
               "メソッド名を `#{scope.name}(*)` に変えてもいいですよー!"
  end

  message
end