Method index
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def index
if params['q'] != nil
params['q'].gsub!('""','')
single_quote_count = params['q'].to_s.count('"')
if(single_quote_count != nil && single_quote_count.odd?)
- 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 transform_unit_scope
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def transform_unit_scope(solr_parameters,params)
if ((params[:f].nil? || params[:f][:type_sim].nil? || !params[:f][:type_sim].include?('Collection')) && params[:fq] && params[:action] != "collection_search")
params[:fq].each do |f|
if f.start_with?('{!join from=collections_tesim to=id}unit_code_tesim:')
# remove query from filters
- 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 index
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
if params['q'] != nil
params['q'].gsub!('""','')
single_quote_count = params['q'].to_s.count('"')
if(single_quote_count != nil && single_quote_count.odd?)
Method collection_search
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def collection_search
# if we already have the parameters set below, then redirect to /search
# this allows removing Collections limit, etc.
#if (params[:sort] || (params[:fq] && params[:fq].to_s.include?('{!join')) )
# redirect_to catalog_index_path params
- 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"