Sha256: 8b2161cdfb879d80f00969de374d9882de808d89d2f135aeb4c8f7afe0e9c2a3
Contents?: true
Size: 584 Bytes
Versions: 4
Compression:
Stored size: 584 Bytes
Contents
# encoding: utf-8 module Rubocop module Cop class OpMethod < Cop MSG = 'When defining the %s operator, name its argument other.' BLACKLISTED = [:+@, :-@, :[], :[]=, :<<] TARGET_ARGS = s(:args, s(:arg, :other)) def on_def(node) name, args, _body = *node if name !~ /\A\w/ && !BLACKLISTED.include?(name) && args.children.size == 1 && args != TARGET_ARGS add_offence(:convention, node.loc.line, sprintf(MSG, name)) end super end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
rubocop-0.8.3 | lib/rubocop/cop/op_method.rb |
rubocop-0.8.2 | lib/rubocop/cop/op_method.rb |
rubocop-0.8.1 | lib/rubocop/cop/op_method.rb |
rubocop-0.8.0 | lib/rubocop/cop/op_method.rb |