Method search
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def search(tokens, projects = nil, options = {})
tokens = Array(tokens)
projects = [] << projects unless projects.nil? || projects.is_a?(Array)
find_order = "#{searchable_options[:order_column]} " + (options[:before] ? "DESC" : "ASC")
- 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 search
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def search(tokens, projects = nil, options = {})
tokens = Array(tokens)
projects = [] << projects unless projects.nil? || projects.is_a?(Array)
find_order = "#{searchable_options[:order_column]} " + (options[:before] ? "DESC" : "ASC")
Method acts_as_searchable
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def acts_as_searchable(options = {})
return if included_modules.include?(Redmine::Acts::Searchable::InstanceMethods)
cattr_accessor :searchable_options
self.searchable_options = options
- 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 searchable_column_conditions
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def searchable_column_conditions
searchable_options[:columns].map do |column|
name, scope = column.is_a?(Hash) ? column.values_at(:name, :scope) : column
match_condition = "(#{Arel.sql(name)} ILIKE ?)"
- 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"