Method render_search_to_page_title
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def render_search_to_page_title(search_state_or_params)
search_state = if search_state_or_params.is_a? Blacklight::SearchState
search_state_or_params
else
controller.search_state_class.new(params, blacklight_config, self)
- 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 page_entries_info
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def page_entries_info(collection, entry_name: nil)
entry_name = if entry_name
entry_name.pluralize(collection.size, I18n.locale)
else
collection.entry_name(count: collection.size).to_s
Method page_entries_info
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def page_entries_info(collection, entry_name: nil)
entry_name = if entry_name
entry_name.pluralize(collection.size, I18n.locale)
else
collection.entry_name(count: collection.size).to_s
- 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 document_index_view_type
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def document_index_view_type query_params = params || {}
view_param = query_params[:view]
view_param ||= session[:preferred_view] if respond_to?(:session)
if view_param && document_index_views.key?(view_param.to_sym)
view_param.to_sym
- 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"