lib/rubocop/cop/rails/inverse_of.rb in rubocop-rails-2.15.2 vs lib/rubocop/cop/rails/inverse_of.rb in rubocop-rails-2.16.0

- old
+ new

@@ -190,12 +190,11 @@ options = arguments.concat(with_options).flat_map do |arg| options_from_argument(arg) end return if options_ignoring_inverse_of?(options) - return unless scope?(arguments) || - options_requiring_inverse_of?(options) + return unless scope?(arguments) || options_requiring_inverse_of?(options) return if options_contain_inverse_of?(options) add_offense(node.loc.selector, message: message(options)) end @@ -204,12 +203,11 @@ !ignore_scopes? && arguments.any?(&:block_type?) end def options_requiring_inverse_of?(options) required = options.any? do |opt| - conditions_option?(opt) || - foreign_key_option?(opt) + conditions_option?(opt) || foreign_key_option?(opt) end return required if target_rails_version >= 5.2 required || options.any? { |opt| as_option?(opt) } @@ -225,11 +223,10 @@ options.any? { |opt| inverse_of_option?(opt) } end def with_options_arguments(recv, node) blocks = node.each_ancestor(:block).select do |block| - block.send_node.command?(:with_options) && - same_context_in_with_options?(block.arguments.first, recv) + block.send_node.command?(:with_options) && same_context_in_with_options?(block.arguments.first, recv) end blocks.flat_map { |n| n.send_node.arguments } end def same_context_in_with_options?(arg, recv)