Showing 9 of 11 total issues
File numeral.rb
has 390 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "forwardable"
require_relative "numeral/configuration"
require_relative "numeral/version"
Method monetize
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def monetize(num, **options)
check_number(num, **options)
sep = options.fetch(:separator, @configuration.separator)
curr_name = options.fetch(:currency, @configuration.currency)
n = format("%0.2f", num.to_s)
- 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_numeral
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def convert_numeral(num, **options)
delimiter = options.fetch(:delimiter, @configuration.delimiter)
decimal = options.fetch(:decimal, @configuration.decimal)
separator = options.fetch(:separator, @configuration.separator)
- 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
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def ordinalize(num, **options)
check_number(num, **options)
if options[:short]
ordinalize_short(num)
else
Method ordinalize
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def ordinalize(num, **options)
check_number(num, **options)
if options[:short]
ordinalize_short(num)
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_decimals
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def convert_decimals(num, **options)
delimiter = options.fetch(:delimiter, @configuration.delimiter)
decimal = options.fetch(:decimal, @configuration.decimal)
trailing_zeros = options.fetch(:trailing_zeros, @configuration.trailing_zeros)
- 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 update
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update(currency: nil, delimiter: nil, separator: nil, decimal: nil,
trailing_zeros: nil, strict: nil)
@currency = currency if currency
@delimiter = delimiter if delimiter
@separator = separator if separator
- 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_to_words
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def convert_to_words(n)
words = []
SCALES.each_with_index do |scale, i|
mod = n % 1000
- 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_tens
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def convert_tens(num)
word = []
tens = num % 100
if tens.to_s.size < 2 || tens <= 20
- 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"