Method current_search_query
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def current_search_query(accounts)
terms = []
[:priority, :state, :target, :type].each do |name|
next if params[name].blank?
- 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 current_search_query
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def current_search_query(accounts)
terms = []
[:priority, :state, :target, :type].each do |name|
next if params[name].blank?
Method sort_by
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def sort_by(column)
current_column, current_dir = params[:order].to_s.split(":")
dir = current_dir == "asc" ? "desc" : "asc"
link = link_to(column.titleize, current_path(params.merge(:order => "#{column}:#{dir}")))
- 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 account_options
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def account_options(accounts)
options = []
Array(accounts).sort_by { |u| u.username }.group_by(&:username).each do |_, users|
users.each do |u|
- 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_option_value
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def format_option_value(name, value)
if name == :rate && value.present?
number_with_delimiter(value) << " Kbps"
elsif name == :password
"*" * 8
- 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"