Showing 74 of 74 total issues
Method facet_field_aggregations
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def facet_field_aggregations
list_as_hash(facet_fields).each_with_object({}) do |(facet_field_name, values), hash|
items = values.map do |value, hits|
i = FacetItem.new(value: value, hits: hits)
- 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(group, facet_item, facet_config, view_context, facet_field, search_state = view_context.search_state)
Method values
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def values(except: [])
params = search_state.params
return [] if params.blank?
f = except.include?(:filters) ? [] : [params.dig(filters_key, key)].flatten.compact
- 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_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_facet_paging_to_solr
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add_facet_paging_to_solr(solr_params)
return if facet.blank?
facet_config = blacklight_config.facet_fields[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 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 render
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.render(values, config, document, context, options)
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 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 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 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 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 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 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 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 add_blacklight_field
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_blacklight_field config_key, *args, &block
field_config = case args.first
when String
field_config_from_key_and_hash(config_key, *args)
when Symbol
- 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"