Method search_param
has a Cognitive Complexity of 90 (exceeds 5 allowed). Consider refactoring. Open
def search_param
if @search
conditions = []
@resource.columns.each_with_index do |column, index|
- 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_param
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
def search_param
if @search
conditions = []
@resource.columns.each_with_index do |column, index|
Method perform
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def perform(resource)
@resource = @records = resource
@tables_associated_to_relations_name =
ForestLiana::QueryHelper.get_tables_associated_to_relations_name(@resource)
@records = search_param
- 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
Avoid deeply nested control flow statements. Open
if @collection.search_fields.nil? || (association_search &&
association_search.include?(column.name))
conditions << association_search_condition(resource.table_name,
column.name)
end
Avoid deeply nested control flow statements. Open
if !(column.respond_to?(:array) && column.array) && text_type?(column.type)
if association_search.include?(column.name)
conditions << association_search_condition(resource.table_name,
column.name)
end
Method sort_query
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def sort_query
if @params[:sort]
@params[:sort].split(',').each do |field|
order_detected = detect_sort_order(field)
order = order_detected.upcase
- 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 detect_reference
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def detect_reference(param)
ref, field = param.split('.')
if ref && field
association = @resource.reflect_on_all_associations
- 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"