Showing 446 of 1,255 total issues
Method sortable
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def sortable(column, title = nil)
title ||= column.titleize
css_class = column == @sort_column ? "current #{@sort_direction}" : nil
direction = column == @sort_column && @sort_direction == :asc ? :desc : :asc
link_to title, { sort: column, direction: direction}, { class: css_class }
- 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 mentioned_users
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def mentioned_users
users = []
TextFilters::UserMentionFilter.mentioned_usernames_in(self.body, self.wip.product) do |username, u|
if u
users << u if u && u != user
- 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 median
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.median(attr_name)
raise "that attribute name is invalid!" unless valid_numerical_attribute_type?(attr_name)
r = all_most_recent(attr_name).order(attr_name => :asc)
total = r.count
return "error" if total < 1
- 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 time_left_text
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def time_left_text
days = ((self.expiration - Time.now)/86400).to_i.abs
if days == 0
days = ((self.expiration - Time.now)/3600).to_i
- 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 initialize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def initialize(filters={})
search = {
filter: {
bool: {
must: [{
- 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 format_coins
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def format_coins(product, cents, format = :full, options={})
label = currency = product.for_profit? ? 'coins' : 'karma'
if product.for_profit?
label = "#{product.name} #{currency}"
- 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"