Sha256: d9ad8b3b1a460bf36f3cc2cf189040e993b2d405559a9b7912c348659790f058
Contents?: true
Size: 566 Bytes
Versions: 2
Compression:
Stored size: 566 Bytes
Contents
module RuboCop module Cop module Ipepe class MultipleConditionUnless < ::RuboCop::Cop::Base extend AutoCorrector MSG = "Use only one condition in unless or change to if".freeze def on_if(node) return unless node.unless? return unless node.condition.and_type? add_offense(node) do |corrector| # change `unless` to `if !(condition)` corrector.replace(node, "if !(#{node.condition.source})\n#{node.if_branch.source}\nend") end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rubocop-ipepe-0.2.5 | lib/rubocop/cop/ipepe/multiple_condition_unless.rb |
rubocop-ipepe-0.2.0 | lib/rubocop/cop/ipepe/multiple_condition_unless.rb |