Sha256: 9d397b7482693c69444bf8d8d5330a17b5a8a4cc05cabd49e1e537fd0be4f878
Contents?: true
Size: 715 Bytes
Versions: 19
Compression:
Stored size: 715 Bytes
Contents
# encoding: utf-8 module RuboCop module Cop # Some common code shared between FavorUnlessOverNegatedIf and # FavorUntilOverNegatedWhile. module NegativeConditional def check_negative_conditional(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 return unless condition.type == :send _object, method = *condition return unless method == :! && !(node.loc.respond_to?(:else) && node.loc.else) add_offense(node, :expression) end end end end
Version data entries
19 entries across 19 versions & 2 rubygems