Showing 71 of 75 total issues
Class Configuration
has 32 methods (exceeds 20 allowed). Consider refactoring. Open
class Configuration < OpenStructWithHashAccess
extend ActiveSupport::Autoload
eager_autoload do
autoload :Context
autoload :ViewConfig
Class SearchState
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class SearchState
attr_reader :blacklight_config # Must be called blacklight_config, because Blacklight::Facet calls blacklight_config.
# This method is never accessed in this class, but may be used by subclasses that need
# to access the url_helpers
File search_builder_behavior.rb
has 294 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Blacklight::Solr
module SearchBuilderBehavior
extend ActiveSupport::Concern
included do
File configuration.rb
has 289 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Blacklight
##
# Blacklight::Configuration holds the configuration for a Blacklight::Controller, including
# fields to display, facets to show, sort options, and search fields.
class Configuration < OpenStructWithHashAccess
Class SearchBuilder
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class SearchBuilder
class_attribute :default_processor_chain
self.default_processor_chain = []
attr_reader :processor_chain, :search_state, :blacklight_params
Function Modal
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Modal = (() => {
const modal = {}
// a Bootstrap modal div that should be already on the page hidden
modal.modalSelector = '#blacklight-modal';
Method call
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def call
facet = Blacklight::FacetItemComponent.new(facet_item: @facet_item, wrapping_element: nil, suppress_link: @suppress_link)
id = "h-#{self.class.mint_id}" if @collapsing && has_items?
- 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_value_to_fq_string
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def facet_value_to_fq_string(facet_field, value, use_local_params: true)
facet_config = blacklight_config.facet_fields[facet_field]
solr_field = facet_config.field if facet_config && !facet_config.query
solr_field ||= facet_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 add_facet_fq_to_solr
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def add_facet_fq_to_solr(solr_parameters)
# convert a String value into an Array
if solr_parameters[:fq].is_a? String
solr_parameters[:fq] = [solr_parameters[:fq]]
end
- 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 create
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def create
@bookmarks = if params[:bookmarks]
permit_bookmarks[:bookmarks]
else
[{ document_id: params[:id], document_type: blacklight_config.document_model.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 normalize!
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def normalize! blacklight_config = nil
query.stringify_keys! if query
normalize_pivot_config! if pivot
self.collapse = true if collapse.nil?
- 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_facetting_to_solr
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def add_facetting_to_solr(solr_parameters)
facet_fields_to_include_in_request.each do |field_name, facet|
solr_parameters[:facet] ||= true
if facet.json
- 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_item_presenters
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def facet_item_presenters
return to_enum(:facet_item_presenters) unless block_given?
@search_state.filters.map do |facet|
facet.each_value do |val|
- 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_limit
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def facet_limit
return unless facet_field.limit
if @display_facet
limit = @display_facet.limit
- 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_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 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 label
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def label
label_value = if facet_item.respond_to? :label
facet_item.label
else
value
- 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 before_render
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def before_render
set_slot(:title, nil) unless title
set_slot(:thumbnail, nil) unless thumbnail || show?
set_slot(:metadata, nil, fields: presenter.field_presenters) unless metadata
set_slot(:embed, nil) unless embed
- 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 deep_unmangle_params!
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def deep_unmangle_params!(params, permitted_params)
permitted_params.select { |p| p.is_a?(Hash) }.each do |permission|
permission.each do |key, permitted_value|
next unless params[key].is_a?(ActionController::Parameters)
- 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
Function Blacklight
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const Blacklight = function() {
const buffer = new Array;
return {
onLoad: function(func) {
buffer.push(func);
- 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"