Showing 6 of 6 total issues
Class Language
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class Language
include Kabal::GlobalRules::NaturalNumbers
include Kabal::GlobalRules::FractionalNumbers
include Kabal::GlobalRules::NumberProperities
Method name_with_declination
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def self.name_with_declination(number_name, count)
if count.to_s.include? 'e'
count = count.to_s.split('.')[0].to_i
end
# FIXME add gem russian
- 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
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def convert(number)
if number == 0
'0'
else
symbols = { 0 => ['I', 'V'], 1 => ['X', 'L'], 2 => ['C', 'D'], 3 => ['M'] }
- 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 single
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def single(number, this_is_end = true)
if @feminine_name
@feminine_name = false
return names[:single_feminine][count(number) % 10] if count_can_be_feminine? number
end
- 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
Avoid too many return
statements within this method. Open
return number_name + 'а' if end_with_two_or_three_of_four? count
Method natural_number_name
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def natural_number_name(number)
return single number if number >= 0 && number <= 19
return two_words number if number >= 0 && number <= 99
return three_words number if number >= 100 && number <= 999
ten_powers number if number >= 100
- 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"