Showing 10 of 10 total issues
Function processResponse
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Filterrific.processResponse = function(form, xhr) {
var rawResponse = (_ref = xhr.response) != null ? _ref : xhr.responseText,
type = xhr.getResponseHeader('Content-Type'),
response;
- 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 filterrific_sorting_link
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def filterrific_sorting_link(filterrific, sort_key, opts = {})
opts = {
active_column_class: "filterrific_current_sort_column",
inactive_column_class: "filterrific_sort_column",
ascending_indicator: "⬆",
- 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 condition_filterrific_params
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def condition_filterrific_params(fp)
fp.each do |key, val|
if val.is_a?(Proc)
# evaluate Procs
fp[key] = val.call
- 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 observe_field
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Filterrific.observe_field = function(inputs_selector, frequency, callback) {
frequency = frequency * 1000;
document.querySelectorAll(inputs_selector).forEach(input => {
var prev = input.value;
Method filterrific_sorting_link
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def filterrific_sorting_link(filterrific, sort_key, opts = {})
opts = {
active_column_class: "filterrific_current_sort_column",
inactive_column_class: "filterrific_sort_column",
ascending_indicator: "⬆",
Method initialize
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def initialize(a_model_class, filterrific_params = {})
self.model_class = a_model_class
@select_options = {}
# Use either passed in filterrific_params or resource class' default_settings.
- 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_filterrific
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def initialize_filterrific(model_class, filterrific_params, opts = {})
f_params = (filterrific_params || {}).stringify_keys
opts = opts.stringify_keys
pers_id = if opts["persistence_id"] == false
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 filterrific_find
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def filterrific_find(filterrific_param_set)
unless filterrific_param_set.is_a?(Filterrific::ParamSet)
raise(
ArgumentError,
"Invalid Filterrific::ParamSet: #{filterrific_param_set.inspect}"
- 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 findParents
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Filterrific.findParents = function(elem, selector) {
var elements = [];
var ishaveselector = selector !== undefined;
while ((elem = elem.parentElement) !== null) {
- 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 to_hash
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def to_hash
{}.tap { |h|
model_class.filterrific_available_filters.each do |filter_name|
param_value = send(filter_name)
if param_value.blank?
- 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"