Sha256: b7000ac9782958f743ec4bfb4cb64a3192255522111a17b2fa3ea0085588d51d
Contents?: true
Size: 764 Bytes
Versions: 3
Compression:
Stored size: 764 Bytes
Contents
# encoding: utf-8 module Rubocop module Cop module Style # This cop checks for uses of String#%. # # It cannot be implemented in a reliable manner for all cases, so # only two scenarios are considered - if the first argument is a string # literal and if the second argument is an array literal. class FavorSprintf < Cop MSG = 'Favor sprintf over String#%.' def on_send(node) receiver_node, method_name, *arg_nodes = *node if method_name == :% && ([:str, :dstr].include?(receiver_node.type) || arg_nodes[0].type == :array) add_offence(:convention, node.loc.selector, MSG) end super end end end end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
rubocop-0.9.1 | lib/rubocop/cop/style/favor_sprintf.rb |
sabat-rubocop-0.9.0 | lib/rubocop/cop/style/favor_sprintf.rb |
rubocop-0.9.0 | lib/rubocop/cop/style/favor_sprintf.rb |