File filter.rb
has 396 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Queries
# Overview
#
# This class manages params and nesting of filter queries.
Class Filter
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
class Query::Filter < Queries::Query
include Queries::Concerns::Users
# include Queries::Concerns::Identifiers # Presently in Queries for other use in autocompletes
Method included_annotator_facets
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def self.included_annotator_facets
f = [
::Queries::Concerns::Users
]
- 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 too many lines. [40/25] Open
def permitted_params(hsh)
h = self.class::PARAMS.deep_dup
h.unshift(:per)
h.unshift(:page)
h.unshift(:paginate)
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method permitted_params
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def permitted_params(hsh)
h = self.class::PARAMS.deep_dup
h.unshift(:per)
h.unshift(:page)
h.unshift(:paginate)
Method permitted_params
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def permitted_params(hsh)
h = self.class::PARAMS.deep_dup
h.unshift(:per)
h.unshift(:page)
h.unshift(:paginate)
- 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 annotator_merge_clauses
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def annotator_merge_clauses
a = []
# !! Interesting `.compact` removes #<ActiveRecord::Relation []>,
# so patterns that us collect.flatten.compact return empty,
- 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 all
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def all(nil_empty = false)
# TODO: should turn off/on project_id here on nil empty?
a = all_and_clauses
- 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 annotator_params
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.annotator_params
h = nil
if i = included_annotator_facets
# Setup with the first
a = i.shift
- 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 set_nested_queries
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def set_nested_queries(params)
if n = params.select{|k, p| k.to_s =~ /_query/ }
return nil if n.keys.count != 1 # !!! can't have multiple nested queries inside one level !!! This lets us eliminate infinite loops at the cost of expressiveness?!
- 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 annotator_and_clauses
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def annotator_and_clauses
a = []
self.class.included_annotator_facets.each do |c|
if c.respond_to?(:and_clauses)
c.and_clauses.each do |f|
- 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
TODO found Open
# TODO: macro these dynamically
- Exclude checks
TODO found Open
# TODO: Think we need to handle ' and '
- Exclude checks
TODO found Open
# TODO There is room for an AlternateValue concern here
- Exclude checks
TODO found Open
# TODO: when a nesting problem is found we need to flag the query as invalid
- Exclude checks
TODO found Open
# TODO: should turn off/on project_id here on nil empty?
- Exclude checks