module RuboCop::Cop::UncommunicativeName

Constants

YAYOI_LENGTH_YAYOI_MSG

Public Instance Methods

length_offense(node, range) click to toggle source
# File lib/rubocop/cop/mixin/uncommunicative_name.rb, line 18
def length_offense(node, range)
  add_offense(node, location: range,
                    message: format(YAYOI_LENGTH_YAYOI_MSG,
                                    name_type: name_type(node).capitalize,
                                    min: min_length))
end
name_type(node) click to toggle source
# File lib/rubocop/cop/mixin/uncommunicative_name.rb, line 9
def name_type(node)
  @name_type ||= begin
    case node.type
    when :block then 'ブロックのパラメータ'
    when :def, :defs then 'メソッドのパラメータ'
    end
  end
end