Showing 6 of 6 total issues
Method preprocess
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def preprocess(money)
money = money.to_s
fail ArgumentError, "Not a valid money<#{money}>" \
unless money.match(/^[\d|,|\.]+/)
- 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 part_ge
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def part_ge
yi, wan, ge = parts
if ge.zero?
if yi.zero? && wan.zero?
- 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 part_wan
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def part_wan
yi, wan, ge = parts
if wan.zero?
if yi.nonzero? && ge.nonzero?
- 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 split_into_digits
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def split_into_digits(number, direction: :head, count: 4)
digits = number.to_s.chars.map(&:to_i)
if direction == :head
digits.unshift 0 while digits.count < count
else
- 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 convert_decimal
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def convert_decimal
return DECIMAL_UNIT[0] if decimal.to_i.zero?
jiao, fen = split_into_digits(decimal, direction: :tail, count: 2)
- 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 read_integer
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def read_integer(number)
return NUMBERS[0] if number.zero?
numbers = split_into_digits(number)
- 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"