Method json_facet_aggregations
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def json_facet_aggregations
return {} unless self['facets']
self['facets'].each_with_object({}) do |(facet_field_name, data), hash|
next if facet_field_name == 'count'
- 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 facet_query_aggregations
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def facet_query_aggregations
return {} unless blacklight_config
blacklight_config.facet_fields.select { |_k, v| v.query }.each_with_object({}) do |(field_name, facet_field), hash|
salient_facet_queries = facet_field.query.map { |_k, x| x[:fq] }
- 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 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 list_as_hash
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def list_as_hash solr_list
# map
if solr_list.values.first.is_a? Hash
solr_list
else
- 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"