neo4jrb/neo4j

View on GitHub

Showing 339 of 339 total issues

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

    def apply_default_values
      return if self.class.declared_property_defaults.empty?
      self.class.declared_property_defaults.each_pair do |key, value|
        self.send("#{key}=", value.respond_to?(:call) ? value.call : value) if self.send(key).nil?
      end
Severity: Minor
Found in lib/active_graph/shared/persistence.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 set_instance_caches has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def set_instance_caches(instance, node, rel)
          instance.each do |object|
            object.instance_variable_set('@source_query_proxy', self)
            object.instance_variable_set('@source_proxy_result_cache', instance)
            if node && rel && object.last.is_a?(ActiveGraph::Relationship)
Severity: Minor
Found in lib/active_graph/node/query/query_proxy_enumerable.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 for_where_clause has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

            def for_where_clause(arg, model, *args)
              node_num = 1
              result = []
              if arg.is_a?(Hash)
                arg.each do |key, value|
Severity: Minor
Found in lib/active_graph/node/query/query_proxy_link.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 constantize_argument has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def constantize_argument(class_argument)
        case class_argument
        when 'any', :any, false, nil
          nil
        when Array
Severity: Minor
Found in lib/active_graph/class_arguments.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 inject_defaults! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def inject_defaults!(object, props)
      declared_property_defaults.each_pair do |k, v|
        props[k.to_sym] = v.respond_to?(:call) ? v.call : v if object.send(k).nil? && props[k.to_sym].nil?
      end
      props
Severity: Minor
Found in lib/active_graph/shared/declared_properties.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 count has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def count(distinct = nil, target = nil)
          return 0 if unpersisted_start_object?
          fail(ActiveGraph::InvalidParameterError, ':count accepts the `:distinct` symbol or nil as a parameter') unless distinct.nil? || distinct == :distinct
          query_with_target(target) do |var|
            q = ensure_distinct(var, !distinct.nil?)
Severity: Minor
Found in lib/active_graph/node/query/query_proxy_methods.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 get_direction has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def get_direction(create, reverse = false)
          dir = (create && @direction == :both) ? :out : @direction
          if reverse
            case dir
            when :in then :out
Severity: Minor
Found in lib/active_graph/node/has_n/association.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 validate_model_schema! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def validate_model_schema!
        ensure_model_data_state!
        messages = {index: [], constraint: []}
        each_schema_element do |type, model, label, property_name, exists|
          if exists
Severity: Minor
Found in lib/active_graph/model_schema.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 cypher_string has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def cypher_string(dir = :outbound)
        case dir
        when :outbound
          identifier = '(n1'
          identifier + (_from_class == :any ? ')' : cypher_label(:outbound))
Severity: Minor
Found in lib/active_graph/relationship/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

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

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

          options = default_options.merge(options)
Severity: Minor
Found in lib/active_graph/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

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

      def normalize_key_list(enum_keys, options)
        case_sensitive = options.fetch(:_case_sensitive, ActiveGraph::Config.enums_case_sensitive)

        case enum_keys
        when Hash
Severity: Minor
Found in lib/active_graph/shared/enum.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 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/active_graph/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/active_graph/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

Block has too many lines. [137/135]
Open

namespace :neo4j do
  task :allow_migrations do
    ActiveGraph::Migrations.currently_running_migrations = true
  end
  desc 'Run a script against the database to perform system-wide changes'

This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

Method from_key_and_value has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def from_key_and_value(key, value)
          case value
          when String, Symbol
            self.class.from_key_and_single_value(key, value)
          when Array
Severity: Minor
Found in lib/active_graph/core/query_clauses.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 _nodeify! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def _nodeify!(*args)
          other_nodes = [args].flatten!.map! do |arg|
            (arg.is_a?(Integer) || arg.is_a?(String)) ? @model.find_by(id: arg) : arg
          end.compact

Severity: Minor
Found in lib/active_graph/node/query/query_proxy.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 perform_validations has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def perform_validations(options = {})
        perform_validation = case options
                             when Hash
                               options[:validate] != false
                             end
Severity: Minor
Found in lib/active_graph/shared/validations.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 instantiate_object has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def instantiate_object(field, values_with_empty_parameters)
      return nil if values_with_empty_parameters.all?(&:nil?)
      values = values_with_empty_parameters.collect { |v| v.nil? ? 1 : v }
      klass = field.type
      klass ? klass.new(*values) : values
Severity: Minor
Found in lib/active_graph/shared/property.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 validate_conf! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def validate_conf!(conf)
        fail "Expected a Hash, got #{conf.class} (#{conf}) for id_property" if !conf.is_a?(Hash)

        return if conf[:on]

Severity: Minor
Found in lib/active_graph/node/id_property.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 match_nodes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def match_nodes(hash, optional_match = false)
        hash.inject(self) do |query, (variable, node_object)|
          neo_id = (node_object.respond_to?(:neo_id) ? node_object.neo_id : node_object)

          match_method = optional_match ? :optional_match : :match
Severity: Minor
Found in lib/active_graph/core/query.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