e-travel/agnostic_backend

View on GitHub

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
Severity: Minor
Found in lib/agnostic_backend/queryable/validator.rb - About 4 hrs to fix

    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
    Severity: Minor
    Found in lib/agnostic_backend/queryable/visitor.rb - About 3 hrs to fix

      Class SimpleVisitor has 28 methods (exceeds 20 allowed). Consider refactoring.
      Open

            class SimpleVisitor < AgnosticBackend::Queryable::Visitor
      
              private
      
              def visit_criteria_equal(subject)
      Severity: Minor
      Found in lib/agnostic_backend/queryable/cloudsearch/simple_visitor.rb - About 3 hrs to fix

        Class Visitor has 28 methods (exceeds 20 allowed). Consider refactoring.
        Open

              class Visitor < AgnosticBackend::Queryable::Visitor
        
                private
        
                def visit_criteria_equal(subject)
        Severity: Minor
        Found in lib/agnostic_backend/queryable/cloudsearch/visitor.rb - About 3 hrs to fix

          Class Visitor has 26 methods (exceeds 20 allowed). Consider refactoring.
          Open

                class Visitor < AgnosticBackend::Queryable::Visitor
          
                  private
          
                  def visit_criteria_equal(subject)
          Severity: Minor
          Found in lib/agnostic_backend/queryable/elasticsearch/visitor.rb - About 3 hrs to fix

            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
            Severity: Minor
            Found in lib/agnostic_backend/utilities.rb - About 2 hrs to fix

            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)
            Severity: Minor
            Found in lib/agnostic_backend/queryable/validator.rb - About 2 hrs to fix

            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
            Severity: Minor
            Found in lib/agnostic_backend/utilities.rb - About 1 hr to fix

              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)
              Severity: Minor
              Found in lib/agnostic_backend/cloudsearch/index.rb - About 1 hr to fix

              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)
              Severity: Minor
              Found in lib/agnostic_backend/queryable/validator.rb - About 1 hr to fix

                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
                Severity: Minor
                Found in lib/agnostic_backend/indexable/field.rb - About 55 mins to fix

                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
                Severity: Minor
                Found in lib/agnostic_backend/indexable/indexable.rb - About 45 mins to fix

                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
                Severity: Minor
                Found in lib/agnostic_backend/utilities.rb - About 45 mins to fix

                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
                Severity: Minor
                Found in lib/agnostic_backend/queryable/query_builder.rb - About 35 mins to fix

                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
                Severity: Minor
                Found in lib/agnostic_backend/queryable/cloudsearch/executor.rb - About 35 mins to fix

                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
                
                
                Severity: Minor
                Found in lib/agnostic_backend/queryable/tree_node.rb - About 35 mins to fix

                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|
                Severity: Minor
                Found in lib/agnostic_backend/indexable/indexable.rb - About 35 mins to fix

                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
                Severity: Minor
                Found in lib/agnostic_backend/indexable/content_manager.rb - About 25 mins to fix

                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?
                Severity: Minor
                Found in lib/agnostic_backend/indexable/indexable.rb - About 25 mins to fix

                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

                Severity
                Category
                Status
                Source
                Language