Class: RuboCop::Cop::RSpecParity::SufficientContexts::BranchTally
- Inherits:
-
Struct
- Object
- Struct
- RuboCop::Cop::RSpecParity::SufficientContexts::BranchTally
- Defined in:
- lib/rubocop/cop/rspec_parity/sufficient_contexts.rb
Overview
Branch tally split into guard-clause “fire” branches vs. every other branch. A sequence of guard clauses (‘return/raise/next … if/unless`) shares a single “all guards pass” fall-through, so that happy path is counted once for the whole method (see #branches_from) rather than once per guard — which previously inflated guard-heavy methods.
Instance Attribute Summary collapse
-
#guard ⇒ Object
Returns the value of attribute guard.
-
#regular ⇒ Object
Returns the value of attribute regular.
Instance Method Summary collapse
Instance Attribute Details
#guard ⇒ Object
Returns the value of attribute guard
71 72 73 |
# File 'lib/rubocop/cop/rspec_parity/sufficient_contexts.rb', line 71 def guard @guard end |
#regular ⇒ Object
Returns the value of attribute regular
71 72 73 |
# File 'lib/rubocop/cop/rspec_parity/sufficient_contexts.rb', line 71 def regular @regular end |
Instance Method Details
#+(other) ⇒ Object
72 73 74 |
# File 'lib/rubocop/cop/rspec_parity/sufficient_contexts.rb', line 72 def +(other) BranchTally.new(guard + other.guard, regular + other.regular) end |
#total ⇒ Object
76 77 78 |
# File 'lib/rubocop/cop/rspec_parity/sufficient_contexts.rb', line 76 def total guard + regular end |