Method do_field_search
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def do_field_search
filtered_columns = []
text_search = active_scaffold_config.field_search.text_search
columns = active_scaffold_config.field_search.columns
search_params.each do |key, value|
- 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 init_field_search_params
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def init_field_search_params(default_params)
return unless (params[:search].is_a?(String) || search_params.nil?) && params[:search].blank?
params[:search] = default_params.is_a?(Proc) ? instance_eval(&default_params) : default_params
end
- 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 custom_finder_options
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def custom_finder_options
if grouped_search?
group_sql = calculation_for_group_by(search_group_column&.field || search_group_name)
select_query = grouped_search_select
select_query << group_sql.as(search_group_column.name.to_s) if search_group_column && group_sql.respond_to?(:to_sql)
- 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"