Skip to content

Commit

Permalink
Fix documentation example for ABC Size (#3985)
Browse files Browse the repository at this point in the history
The given code example has an ABC size of 6.4, but comments list the
calculation as:

Math.sqrt(1*1 + 5*5 + 2*2)

which results in: 5.48.

The correct calculation for the given the example are:

Math.sqrt(1*1 + 6*6 + 2*2) = 6.40
  • Loading branch information
a-leung authored and bbatsov committed Jan 30, 2017
1 parent a7c7ee5 commit 2ce51e1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion spec/rubocop/cop/metrics/abc_size_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
'end'])
expect(cop.messages)
.to eq(['Assignment Branch Condition size for method_name is too ' \
'high. [6.4/0]']) # sqrt(1*1 + 5*5 + 2*2) => 6.4
'high. [6.4/0]']) # sqrt(1*1 + 6*6 + 2*2) => 6.4
end

context 'target_ruby_version >= 2.3', :ruby23 do
Expand Down

0 comments on commit 2ce51e1

Please sign in to comment.