Showing 71 of 75 total issues
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 collation
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def collation
# FIXME: DRY up with words
spellcheck = response[:spellcheck]
return unless spellcheck && spellcheck[:suggestions]
- 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 initialize
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(values, config, document, context, options, stack)
Method initialize
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(values, config, document, context, operations, options)
Method initialize
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(group, facet_item, facet_config, view_context, facet_field, search_state = view_context.search_state)
Method append_query
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def append_query(query)
return if query.nil?
if self['q'] || dig(:json, :query, :bool)
self[:json] ||= { query: { bool: { must: [] } } }
- 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 add_adv_search_clauses
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add_adv_search_clauses(solr_parameters)
return if search_state.clause_params.blank?
defaults = { must: [], must_not: [], should: [] }
default_op = blacklight_params[:op]&.to_sym || :must
- 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 initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(facet_item, facet_config, view_context, facet_field, search_state = view_context.search_state)
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(key, user_parameters, field_config, view_context, search_state = view_context.search_state)
Method render
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.render(values, config, document, context, options)
Method track
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def track
search_session['counter'] = params[:counter]
search_session['id'] = params[:search_id]
search_session['per_page'] = params[:per_page]
search_session['document_id'] = params[:document_id]
- 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 flatten_hash
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def flatten_hash(hash = params, ancestor_names = [])
flat_hash = {}
hash.each do |k, v|
names = Array.new(ancestor_names)
names << k
- 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 has?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def has?(k, *values)
if !key?(k)
false
elsif values.empty?
self[k].present?
- 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 render_filtered_partials
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def render_filtered_partials(partials, options = {})
content = []
filter_partials(partials, options).each do |key, config|
config.key ||= key
rendered = render(partial: config.partial || key.to_s, locals: { document_action_config: config }.merge(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 display_type
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def display_type(base_name = nil, default: nil)
fields = []
fields += Array.wrap(view_config[:"#{base_name}_display_type_field"]) if base_name && view_config.key?(:"#{base_name}_display_type_field")
fields += Array.wrap(view_config.display_type_field)
- 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 initialize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def initialize(display_facet_or_field_config: nil, display_facet: nil, field_config: nil, response: nil, blacklight_config: nil, component: nil, **component_args)
if display_facet_or_field_config.is_a? Blacklight::FacetFieldPresenter
@facet_field_presenter = display_facet_or_field_config
@field_config = @facet_field_presenter.facet_field
@display_facet = @facet_field_presenter.display_facet
- 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 remove
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def remove(item)
new_state = search_state.reset_search
return new_state.filter(item.field).remove(item) if item.respond_to?(:field) && item.field != key
- 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 values
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def values(except: [])
return nil unless pivot.is_a?(Array) && pivot.present?
params = search_state.params
# values should have at most one terminal blank pivot
- 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 fields_to_render
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def fields_to_render(document_fields = fields, **kwargs)
return to_enum(:fields_to_render, document_fields, **kwargs) unless block_given?
document_fields.each do |name, field_config|
field_presenter = field_presenter(field_config, kwargs)
- 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 append_boolean_query
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def append_boolean_query(bool_operator, query)
return if query.blank?
self[:json] ||= { query: { bool: { bool_operator => [] } } }
self[:json][:query] ||= { bool: { bool_operator => [] } }
- 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"