Method units_history_line
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def units_history_line(order_article, order=nil, options={})
order ||= order_article.order
if order.open?
nil
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 order_checks
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def order_checks(order)
result = [] # array of [true/false/:warn/nil, message]
# need articles to order
if order.order_articles.ordered.count == 0
result << [false, I18n.t('helpers.orders.order_checks.none_ordered', count: order.order_articles.ordered.count)]
- 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 pkg_helper
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def pkg_helper(article, options={})
return '' if not article or article.unit_quantity == 1
uq_text = "× #{article.unit_quantity}"
uq_text = content_tag(:span, uq_text, class: 'hidden-phone') if options[:soft_uq]
if options[:plain]
- 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 order_article_class
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def order_article_class(order_article)
if order_article.units > 0
if order_article.missing_units == 0
'used'
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"