Class: RuboCop::Cop::Homebrew::SimpleTernary Private
- Includes:
- SimpleExpression
- Defined in:
- rubocops/simple_ternary.rb
Overview
This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.
Keep the condition and both branches of a ternary simple.
Constant Summary collapse
- MSG =
This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.
"Use `if`/`else` for this complex ternary."
Constants included from SimpleExpression
RuboCop::Cop::Homebrew::SimpleExpression::MAX_VALUE_PARTS
Instance Method Summary collapse
- #on_if(node) ⇒ void private
Methods included from SimpleExpression
#integer_literal?, #literal_or_reference?, #static_expression?
Instance Method Details
#on_if(node) ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
This method returns an undefined value.
27 28 29 30 31 32 33 |
# File 'rubocops/simple_ternary.rb', line 27 def on_if(node) return unless node.ternary? node.each_child_node do |part| add_offense(part) if excessive_logic?(part) end end |