Method create_string
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def create_string
if use_scientific_notation?
exp_pos_sign = exponent < 0 ? '' : '+'
if significand.length > 1
str = "#{significand[0]}.#{significand[1..-1]}E#{exp_pos_sign}#{scientific_exponent}"
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method to_special_bits
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def to_special_bits
high = 0
if match = NAN_REGEX.match(@string)
high = NAN_MASK
high = high | SIGN_BIT_MASK if match[1]
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method round_exact
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def round_exact(exponent, significand)
if exponent < Decimal128::MIN_EXPONENT
if significand.to_i == 0
round = Decimal128::MIN_EXPONENT - exponent
exponent += round
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"