neo4jrb/neo4j-core

View on GitHub

Showing 30 of 34 total issues

File query_clauses.rb has 584 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Neo4j
  module Core
    module QueryClauses
      class ArgError < StandardError
        attr_reader :arg_part
Severity: Major
Found in lib/neo4j/core/query_clauses.rb - About 1 day to fix

    Class Query has 33 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class Query
          include Neo4j::Core::QueryClauses
          include Neo4j::Core::QueryFindInBatches
          DEFINED_CLAUSES = {}
    
    
    Severity: Minor
    Found in lib/neo4j/core/query.rb - About 4 hrs to fix

      Class Clause has 27 methods (exceeds 20 allowed). Consider refactoring.
      Open

            class Clause
              UNDERSCORE = '_'
              COMMA_SPACE = ', '
              AND = ' AND '
              PRETTY_NEW_LINE = "\n  "
      Severity: Minor
      Found in lib/neo4j/core/query_clauses.rb - About 3 hrs to fix

        Class Label has 25 methods (exceeds 20 allowed). Consider refactoring.
        Open

            class Label
              attr_reader :name
        
              def initialize(name, session)
                @name = name
        Severity: Minor
        Found in lib/neo4j/core/label.rb - About 2 hrs to fix

          File query.rb has 278 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require 'neo4j/core/query_clauses'
          require 'neo4j/core/query_find_in_batches'
          require 'active_support/notifications'
          
          module Neo4j
          Severity: Minor
          Found in lib/neo4j/core/query.rb - About 2 hrs to fix

            Method run has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                def run(*args)
                  session, run_in_tx = session_and_run_in_tx_from_args(args)
            
                  fail ArgumentError, 'Expected a block to run in Transaction.run' unless block_given?
            
            
            Severity: Minor
            Found in lib/neo4j/transaction.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 generate_partitioning! has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                    def generate_partitioning!
                      @partitioning = [[]]
            
                      @clauses.each do |clause|
                        if clause.nil? && !fresh_partition?
            Severity: Minor
            Found in lib/neo4j/core/query.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 value has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                    def value
                      return @value if @value
            
                      [String, Symbol, Integer, Hash, NilClass].each do |arg_class|
                        from_method = "from_#{arg_class.name.downcase}"
            Severity: Minor
            Found in lib/neo4j/core/query_clauses.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 clause_strings has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                      def clause_strings(clauses)
                        clauses.flat_map do |clause|
                          Array(clause.value).map do |v|
                            (clause.options[:not] ? 'NOT' : '') + (v.to_s.match(PAREN_SURROUND_REGEX) ? v.to_s : "(#{v})")
                          end
            Severity: Minor
            Found in lib/neo4j/core/query_clauses.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 key_value_string has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                    def key_value_string(key, value, previous_keys = [], is_set = false)
                      param = (previous_keys << key).join(UNDERSCORE)
                      self.class.paramaterize_key!(param)
            
                      if value.is_a?(Range)
            Severity: Minor
            Found in lib/neo4j/core/query_clauses.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 each has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                  def each
                    response = self.response
                    if defined?(Neo4j::Server::CypherResponse) && response.is_a?(Neo4j::Server::CypherResponse)
                      response.unwrapped! if unwrapped?
                      response.to_node_enumeration
            Severity: Minor
            Found in lib/neo4j/core/query.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 hash_key_value_string has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                    def hash_key_value_string(key, value, previous_keys)
                      value.map do |k, v|
                        if k.to_sym == :neo_id
                          v = Array(v).map { |item| (item.respond_to?(:neo_id) ? item.neo_id : item).to_i }
                          key_value_string("ID(#{key})", v)
            Severity: Minor
            Found in lib/neo4j/core/query_clauses.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 _wrap_entity has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                      def _wrap_entity(entity)
                        case @wrap_level
                        when :none then wrap_value(entity)
                        when :core_entity, :proc
                          if type = type_for_entity(entity)
            Severity: Minor
            Found in lib/neo4j/core/cypher_session/responses/embedded.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 initialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                      def initialize(*args)
                        super
                        return unless root?
                        @driver_session = session.adaptor.driver.session(Neo4j::Driver::AccessMode::WRITE)
                        @driver_tx = @driver_session.begin_transaction
            Severity: Minor
            Found in lib/neo4j/core/cypher_session/transactions/driver.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 initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                  def initialize(id, type, properties, start_node_id = nil, end_node_id = nil)
            Severity: Minor
            Found in lib/neo4j/core/relationship.rb - About 35 mins to fix

              Method wrap_relationship has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                        def wrap_relationship(id, from_node_id, to_node_id, type, properties)
              Severity: Minor
              Found in lib/neo4j/core/cypher_session/responses/bolt.rb - About 35 mins to fix

                Method format_label has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                        def format_label(label_arg)
                          return label_arg.map { |arg| format_label(arg) }.join if label_arg.is_a?(Array)
                
                          label_arg = label_arg.to_s.strip
                          if !label_arg.empty? && label_arg[0] != ':'
                Severity: Minor
                Found in lib/neo4j/core/query_clauses.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 from_args has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                          def from_args(args, params, options = {})
                            query_string, params_arg = args
                
                            if query_string.is_a?(String) && (query_string.match(ARG_HAS_QUESTION_MARK_REGEX) || params_arg.is_a?(Hash))
                              if params_arg.is_a?(Hash)
                Severity: Minor
                Found in lib/neo4j/core/query_clauses.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 session_and_run_in_tx_from_args has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def session_and_run_in_tx_from_args(args)
                      fail ArgumentError, 'Too few arguments' if args.empty?
                      fail ArgumentError, 'Too many arguments' if args.size > 2
                
                      if args.size == 1
                Severity: Minor
                Found in lib/neo4j/transaction.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 response has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                      def response
                        return @response if @response
                
                        @response = if session_is_new_api?
                                      @session.query(self, transaction: Transaction.current_for(@session), wrap_level: (:core_entity if unwrapped?))
                Severity: Minor
                Found in lib/neo4j/core/query.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

                Severity
                Category
                Status
                Source
                Language