Sha256: 48f4a494e9ad76d3ec61774d8e4414dbda437d7b1ff33d7819a5af1c20435491
Contents?: true
Size: 719 Bytes
Versions: 6836
Compression:
Stored size: 719 Bytes
Contents
# frozen_string_literal: true module RuboCop module Cop # This class does condition auto-correction class ConditionCorrector class << self def correct_negative_condition(node) condition = negated_condition(node) lambda do |corrector| corrector.replace(node.loc.keyword, node.inverse_keyword) corrector.replace(condition.source_range, condition.children.first.source) end end private def negated_condition(node) condition = node.condition condition = condition.children.first while condition.begin_type? condition end end end end end
Version data entries
6,836 entries across 6,811 versions & 27 rubygems