Showing 7 of 7 total issues
Method number_to_word
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def number_to_word(number)
if number.zero?
I18n.t("long_form.simple.ones.n_0", throw: true)
elsif number < 20
I18n.t("long_form.simple.ones.n_#{number}", throw: true)
- 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 ordinalize_in_full
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def ordinalize_in_full(gender: :masculine, plurality: :singular)
case I18n.locale
when :fr
value = I18n.t("ordinalize_full.n_#{self}_#{gender}", throw: false, default: "")
value = I18n.t("ordinalize_full.n_#{self}", throw: true) if value.empty?
- 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 ordinalize_in_short
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def ordinalize_in_short(gender: :masculine, plurality: :singular)
abs_number = to_i.abs
suffix = \
case I18n.locale
when :en
- 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 ordinalize_in_short
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def ordinalize_in_short(gender: :masculine, plurality: :singular)
abs_number = to_i.abs
suffix = \
case I18n.locale
when :en
Method number_to_word
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def number_to_word(number)
if number.zero?
I18n.t("long_form.simple.ones.n_0", throw: true)
elsif number < 20
I18n.t("long_form.simple.ones.n_#{number}", throw: true)
Method ordinalize_in_full
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def ordinalize_in_full(gender: :masculine, plurality: :singular)
case I18n.locale
when :fr
value = I18n.t("ordinalize_full.n_#{self}_#{gender}", throw: false, default: "")
value = I18n.t("ordinalize_full.n_#{self}", throw: true) if value.empty?
Method number_to_ordinal_word
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def number_to_ordinal_word(number)
if number.zero?
I18n.t("long_form.ordinal.ones.n_0", throw: true)
elsif number < 20
I18n.t("long_form.ordinal.ones.n_#{number}", throw: true)
- 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"