Rating the quality of a response based on the number of typos I have this method which returns the number, but Rubocop said: 


  Assignment Branch Condition size for rating is too high. [15.84/15]


  def rating
    response = response_quality

    if response == 1 &amp;&amp; @typos.zero?
      5
    elsif response == 2 &amp;&amp; @typos.zero?
      4
    elsif response == 3 &amp;&amp; @typos.zero?
      3
    elsif @typos.percent_of(@word_length) &lt; 20
      2
    elsif @typos.percent_of(@word_length) &lt; 30
      1
    elsif @typos.percent_of(@word_length) &gt; 30
      0
    end
  end


What can I change?
What happens when @typos.percent_of(@word_length) is exactly 30?  You need to fill in the gaps.  The last case should be an else rather than an elsif, to ensure that all cases are covered.

Is it guaranteed that response_quality will be 1, 2, or 3?  If it's not obvious from context, then there should be an explanatory comment that other values are or aren't possible.

The solution below would reduce the code a bit, but it's not necessarily better than your original approach, which did have the advantage of regularity in the pattern.

def rating
  if @typos.zero?
    case response_quality
    when 1; return 5
    when 2; return 4
    when 3; return 3
    end
  end

  typo_pct = @typos.percent_of(@word_length)
  typo_pct &lt; 20 ? 2 :
  typo_pct &lt; 30 ? 1 :
                  0
end