neo4jrb/neo4j

View on GitHub

Showing 63 of 342 total issues

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

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

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

      class QueryProxy
        # rubocop:enable Metrics/ClassLength
        include ActiveGraph::Node::Query::QueryProxyEnumerable
        include ActiveGraph::Node::Query::QueryProxyMethods
        include ActiveGraph::Node::Query::QueryProxyMethodsOfMassUpdating
Severity: Minor
Found in lib/active_graph/node/query/query_proxy.rb - About 5 hrs to fix

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

module ActiveGraph::Node
  module HasN
    extend ActiveSupport::Concern

    class NonPersistedNodeError < ActiveGraph::Error; end
Severity: Minor
Found in lib/active_graph/node/has_n.rb - About 4 hrs to fix

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

      class Association
        include ActiveGraph::Shared::RelTypeConverters
        include ActiveGraph::Node::Dependent::AssociationMethods
        include ActiveGraph::Node::HasN::AssociationCypherMethods

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

File type_converters.rb has 337 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/active_graph/shared/type_converters.rb - About 4 hrs to fix

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

    class Query
      include ActiveGraph::Core::QueryClauses
      include ActiveGraph::Core::QueryFindInBatches
      DEFINED_CLAUSES = {}

Severity: Minor
Found in lib/active_graph/core/query.rb - About 4 hrs to fix

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

  class DeclaredProperties
    include ActiveGraph::Shared::TypeConverters

    attr_reader :klass
    delegate :each, :each_pair, :each_key, :each_value, to: :registered_properties
Severity: Minor
Found in lib/active_graph/shared/declared_properties.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/active_graph/migrations/runner.rb - About 3 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/active_graph/core/query_clauses.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/active_graph/node/has_n.rb - About 3 hrs to fix

Method subscribe_to_query has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

        def subscribe_to_query
          ActiveSupport::Notifications.subscribe('neo4j.core.cypher_query') do |_, _start, _finish, _id, payload|
            query = payload[:query]
            params_string = (query.parameters && !query.parameters.empty? ? "| #{query.parameters.inspect}" : EMPTY)
            cypher = query.pretty_cypher ? (NEWLINE_W_SPACES if query.pretty_cypher.include?("\n")).to_s + query.pretty_cypher.gsub(/\n/, NEWLINE_W_SPACES) : query.cypher
Severity: Minor
Found in lib/active_graph/core/instrumentable.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

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

require 'active_graph/core/query_clauses'
require 'active_graph/core/query_find_in_batches'
require 'active_support/notifications'

module ActiveGraph
Severity: Minor
Found in lib/active_graph/core/query.rb - About 2 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/active_graph/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 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/active_graph/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 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/active_graph/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 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/active_graph/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 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/active_graph/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 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/active_graph/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.properties.symbolize_keys!
        begin
          most_concrete_class = class_from_type(rel.type).constantize
          return rel unless most_concrete_class < ActiveGraph::Relationship
Severity: Minor
Found in lib/active_graph/relationship/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 attribute! has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def attribute!(name)
        remove_instance_variable('@attribute_methods_generated') if instance_variable_defined?('@attribute_methods_generated')
        define_attribute_methods([name]) unless attribute_names.include?(name)
        attributes[name.to_s] = declared_properties[name]
        define_method("#{name}=") do |value|
Severity: Minor
Found in lib/active_graph/shared/property.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

Severity
Category
Status
Source
Language