neo4jrb/neo4j

View on GitHub

Class QueryProxy has 38 methods (exceeds 20 allowed). Consider refactoring.
Open

      class QueryProxy
        # rubocop:enable Metrics/ClassLength
        include Neo4j::ActiveNode::Query::QueryProxyEnumerable
        include Neo4j::ActiveNode::Query::QueryProxyMethods
        include Neo4j::ActiveNode::Query::QueryProxyMethodsOfMassUpdating
Severity: Minor
Found in lib/neo4j/active_node/query/query_proxy.rb - About 5 hrs to fix

Class Association has 34 methods (exceeds 20 allowed). Consider refactoring.
Open

      class Association
        include Neo4j::Shared::RelTypeConverters
        include Neo4j::ActiveNode::Dependent::AssociationMethods
        include Neo4j::ActiveNode::HasN::AssociationCypherMethods

Severity: Minor
Found in lib/neo4j/active_node/has_n/association.rb - About 4 hrs to fix

File has_n.rb has 343 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Neo4j::ActiveNode
  module HasN
    extend ActiveSupport::Concern

    class NonPersistedNodeError < Neo4j::Error; end
Severity: Minor
Found in lib/neo4j/active_node/has_n.rb - About 4 hrs to fix

File type_converters.rb has 330 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'date'
require 'bigdecimal'
require 'bigdecimal/util'
require 'active_support/core_ext/big_decimal/conversions'
require 'active_support/core_ext/string/conversions'
Severity: Minor
Found in lib/neo4j/shared/type_converters.rb - About 3 hrs to fix

Class Runner has 29 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Runner
      STATUS_TABLE_FORMAT = '%-10s %-20s %s'.freeze
      SEPARATOR = '--------------------------------------------------'.freeze
      FILE_MISSING = '**** file missing ****'.freeze
      STATUS_TABLE_HEADER = ['Status'.freeze, 'Migration ID'.freeze, 'Migration Name'.freeze].freeze
Severity: Minor
Found in lib/neo4j/migrations/runner.rb - About 3 hrs to fix

Class DeclaredProperties has 29 methods (exceeds 20 allowed). Consider refactoring.
Open

  class DeclaredProperties
    include Neo4j::Shared::TypeConverters

    attr_reader :klass
    delegate :each, :each_pair, :each_key, :each_value, to: :registered_properties
Severity: Minor
Found in lib/neo4j/shared/declared_properties.rb - About 3 hrs to fix

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

    class AssociationProxy
      def initialize(query_proxy, deferred_objects = [], result_cache_proc = nil)
        @query_proxy = query_proxy
        @deferred_objects = deferred_objects

Severity: Minor
Found in lib/neo4j/active_node/has_n.rb - About 3 hrs to fix

Method process_unpersisted_nodes! has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

      def process_unpersisted_nodes!
        deferred_create_cache.dup.each do |association_name, nodes|
          association_proxy = association_proxy(association_name)

          nodes.each do |node|
Severity: Minor
Found in lib/neo4j/active_node/unpersisted.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 wait_for_value has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def wait_for_value(wait, exception_class)
        value = nil
        Timeout.timeout(60) do
          until value
            begin
Severity: Minor
Found in lib/neo4j/session_manager.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 match_to has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

        def match_to(node)
          first_node = node.is_a?(Array) ? node.first : node
          where_arg = if first_node.respond_to?(:neo_id)
                        {neo_id: node.is_a?(Array) ? node.map(&:neo_id) : node}
                      elsif !node.nil?
Severity: Minor
Found in lib/neo4j/active_node/query/query_proxy_methods.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 process_attributes has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def process_attributes(attributes = nil)
      return attributes if attributes.blank?
      multi_parameter_attributes = {}
      new_attributes = {}
      attributes.each_pair do |key, value|
Severity: Minor
Found in lib/neo4j/shared/property.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 association_proxy has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def association_proxy(name, options = {})
      name = name.to_sym
      hash = association_proxy_hash(name, options)
      association_proxy_cache_fetch(hash) do
        if result_cache = self.instance_variable_get('@source_proxy_result_cache')
Severity: Minor
Found in lib/neo4j/active_node/has_n.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 wrapper has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def wrapper(rel)
        rel.props.symbolize_keys!
        begin
          most_concrete_class = class_from_type(rel.rel_type).constantize
          return rel unless most_concrete_class < Neo4j::ActiveRel
Severity: Minor
Found in lib/neo4j/active_rel/rel_wrapper.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 create_or_update has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def create_or_update
      # since the same model can be created or updated twice from a relationship we have to have this guard
      @_create_or_updating = true
      apply_default_values
      result = _persisted_obj ? update_model : create_model
Severity: Minor
Found in lib/neo4j/shared/persistence.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 target_class_option has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def target_class_option(model_class)
          case model_class
          when nil
            @target_class_name_from_name ? "#{association_model_namespace}::#{@target_class_name_from_name}" : @target_class_name_from_name
          when Array
Severity: Minor
Found in lib/neo4j/active_node/has_n/association.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 default_session_type has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def default_session_type
      if ENV['NEO4J_URL']
        scheme = URI(ENV['NEO4J_URL']).scheme
        fail "Invalid scheme for NEO4J_URL: #{scheme}" if !%w(http https bolt).include?(scheme)
        scheme == 'https' ? 'http' : scheme
Severity: Minor
Found in lib/neo4j/railtie.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 constraint_or_index has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def constraint_or_index(name, options)
        # either constraint or index, do not set both
        if options[:constraint]
          fail "unknown constraint type #{options[:constraint]}, only :unique supported" if options[:constraint] != :unique
          constraint(name, type: :unique)
Severity: Minor
Found in lib/neo4j/shared/property.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 arrow_cypher has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

        def arrow_cypher(var = nil, properties = {}, create = false, reverse = false, length = nil)
Severity: Minor
Found in lib/neo4j/active_node/has_n/association_cypher_methods.rb - About 35 mins to fix

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

      def self.inherit_id_property(other)
        return if other.manual_id_property? || !self.id_property?
        id_prop = self.id_property_info
        conf = id_prop[:type].empty? && id_prop[:name] != :neo_id ? {auto: :uuid} : id_prop[:type]
        other.id_property id_prop[:name], conf, true
Severity: Minor
Found in lib/neo4j/active_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 define_has_one_getter has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def define_has_one_getter(name)
        define_method(name) do |node = nil, rel = nil, options = {}|
          options, node = node, nil if node.is_a?(Hash)

          association_proxy = association_proxy(name, {node: node, rel: rel}.merge!(options))
Severity: Minor
Found in lib/neo4j/active_node/has_n.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