Showing 19 of 23 total issues
Class Validator
has 32 methods (exceeds 20 allowed). Consider refactoring. Open
class Validator < AgnosticBackend::Queryable::Visitor
include AgnosticBackend::Utilities
def initialize
Class Visitor
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class Visitor
def visit(subject)
method_name = class_to_method_name(subject.class)
send(method_name, subject)
end
Class SimpleVisitor
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class SimpleVisitor < AgnosticBackend::Queryable::Visitor
private
def visit_criteria_equal(subject)
Class Visitor
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class Visitor < AgnosticBackend::Queryable::Visitor
private
def visit_criteria_equal(subject)
Class Visitor
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class Visitor < AgnosticBackend::Queryable::Visitor
private
def visit_criteria_equal(subject)
Method convert_to
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def convert_to(type, value)
case type
when :integer
if value.is_a?(Fixnum)
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 visit_value
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def visit_value(subject)
case subject.type
when :integer
unless subject.value.is_a?(Fixnum)
subject.context.query.errors[subject.class.name] << value_error(subject)
- 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 convert_to
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def convert_to(type, value)
case type
when :integer
if value.is_a?(Fixnum)
value
Method define_fields_in_domain
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def define_fields_in_domain(flat_schema, verbose: true)
remote_fields = cloudsearch_client.describe_index_fields(domain_name: domain_name).
index_fields.map{|field| RemoteIndexField.new(field)}
puts "Found #{remote_fields.size} remote fields in #{domain_name}" if verbose
local_fields = index_fields(flat_schema)
- 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 visit_value
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def visit_value(subject)
case subject.type
when :integer
unless subject.value.is_a?(Fixnum)
subject.context.query.errors[subject.class.name] << value_error(subject)
Method initialize
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def initialize(value, type, from: nil, **options)
if type == FieldType::STRUCT && from.nil?
raise "A nested type requires the specification of a target class using the `from` argument"
end
@value = value.respond_to?(:call) ? value : value.to_sym
- 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 trigger_index_notification
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def trigger_index_notification
return unless respond_to? :_index_root_notifiers
_index_root_notifiers.each do |index_name, block|
obj = instance_eval &block
obj = [obj] unless obj.respond_to? :each
- 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 value_for_key
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def value_for_key(document, key)
keys = key.split('.')
key = keys.shift
if document.is_a?(Hash)
if document.has_key? 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 build
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def build(**options)
query = create_query(self, **options)
query.children << build_where_expression if @criterion
query.children << build_select_expression if @projections
query.children << build_order_expression if @order_qualifiers
- 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_s
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def to_s
result = ''
result += "search?q=#{query_expression}" if query_expression
result += " filter=#{filter_query}" if filter_query
result += " return=#{return_expression}" if return_expression
- 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 a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def ==(other)
return true if self.__id__ == other.__id__
return false if other.nil?
return false unless other.is_a? AgnosticBackend::Queryable::TreeNode
- 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 schema
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def schema(for_index: nil, &block)
index_name = for_index.nil? ? self.index_name : for_index
manager = index_content_manager(index_name)
raise "Index #{index_name} has not been defined for #{name}" if manager.nil?
kv_pairs = manager.contents.map do |field_name, 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 extract_contents_from
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def extract_contents_from(object, index_name, observer:)
kv_pairs = contents.map do |field_name, field|
field_value = field.evaluate(context: object)
if field.type.nested?
if field_value.respond_to? :generate_document
- 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 generate_document
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def generate_document(for_index: nil, observer: nil)
index_name = for_index.nil? ? self.index_name : for_index.to_s
return unless respond_to? :_index_content_managers
manager = _index_content_managers[index_name.to_s]
raise "Index #{index_name} does not exist" if manager.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"