Sha256: 65cdf353f79a93afa4a25fa1bfd6ac627f6f5cd4d44895e13ad967cd4dff7e76
Contents?: true
Size: 680 Bytes
Versions: 3
Compression:
Stored size: 680 Bytes
Contents
# encoding: utf-8 module Rubocop module Cop # Some common code shared between FavorUnlessOverNegatedIf and # FavorUntilOverNegatedWhile. module NegativeConditional def check(node) condition, _body, _rest = *node # Look at last expression of contents if there's a parenthesis # around condition. condition = condition.children.last while condition.type == :begin if condition.type == :send _object, method = *condition if method == :! && !(node.loc.respond_to?(:else) && node.loc.else) add_offense(node, :expression, error_message) end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rubocop-0.20.0 | lib/rubocop/cop/mixin/negative_conditional.rb |
rubocop-0.19.1 | lib/rubocop/cop/mixin/negative_conditional.rb |
rubocop-0.19.0 | lib/rubocop/cop/mixin/negative_conditional.rb |