maxdemarzi/neography

View on GitHub

Showing 49 of 49 total issues

Class Rest has 53 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Rest
    module Batch
      include Neography::Rest::Helpers
    
      def batch(*args)
Severity: Major
Found in lib/neography/rest/batch.rb - About 7 hrs to fix

    File batch.rb has 331 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module Neography
      class Rest
        module Batch
          include Neography::Rest::Helpers
        
    Severity: Minor
    Found in lib/neography/rest/batch.rb - About 3 hrs to fix

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        class Rest
          module NodeProperties
      
            def set_node_properties(id, properties)
              properties.each do |property, value|
      Severity: Major
      Found in lib/neography/rest/node_properties.rb and 1 other location - About 3 hrs to fix
      lib/neography/rest/relationship_properties.rb on lines 2..45

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 131.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        class Rest
          module RelationshipProperties
          
            def set_relationship_properties(id, properties)
              properties.each do |property, value|
      Severity: Major
      Found in lib/neography/rest/relationship_properties.rb and 1 other location - About 3 hrs to fix
      lib/neography/rest/node_properties.rb on lines 2..45

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 131.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Method find has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

            def find(*args)
              db = args[3] ? args.pop : Neography::Rest.new
      
              if self <= Neography::Node
                nodes = []
      Severity: Minor
      Found in lib/neography/index.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 iterator has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          def iterator
            options = {
              "order"         => @order,
              "uniqueness"    => @uniqueness,
              "relationships" => @relationships
      Severity: Minor
      Found in lib/neography/node_traverser.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 return_result has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def return_result(response, code, body, parsed, path, query_body)
            case code
            when 200
              @logger.debug "OK #{body}" if @log_enabled
              parsed ? body : @parser.json(body)
      Severity: Minor
      Found in lib/neography/connection.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 each has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def each
            iterator.each do |path|
              paths = Array.new
      
              if @get.include?("node")
      Severity: Minor
      Found in lib/neography/path_traverser.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 convert_cypher has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def convert_cypher(statements)
              array = []
              query = nil
              parameters = nil
              Array(statements).each do |statement|
      Severity: Minor
      Found in lib/neography/rest/transactions.rb - About 1 hr to fix

        Method create_nodes_threaded has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def create_nodes_threaded(nodes)
                nodes = Array.new(nodes) if nodes.kind_of? Fixnum
        
                node_queue = Queue.new
                thread_pool = []
        Severity: Minor
        Found in lib/neography/rest/nodes.rb - About 1 hr to fix

          Method handle_4xx_500_response has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def handle_4xx_500_response(response, code, body, path, query_body)
                index = 0
                request = {:path => path, :body => query_body}
                if body.nil? or body == ""
                  parsed_body = {"message" => "No error message returned from server.",
          Severity: Minor
          Found in lib/neography/connection.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 create_nodes_threaded has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                def create_nodes_threaded(nodes)
                  nodes = Array.new(nodes) if nodes.kind_of? Fixnum
          
                  node_queue = Queue.new
                  thread_pool = []
          Severity: Minor
          Found in lib/neography/rest/nodes.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 save_local_configuration has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def save_local_configuration(config)
                @protocol           = config[:protocol]
                @server             = config[:server]
                @port               = config[:port]
                @directory          = config[:directory]
          Severity: Minor
          Found in lib/neography/connection.rb - About 1 hr to fix

            Method iterator has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def iterator
                  options = {
                    "order"         => @order,
                    "uniqueness"    => @uniqueness,
                    "relationships" => @relationships
            Severity: Minor
            Found in lib/neography/node_traverser.rb - About 1 hr to fix

              Method []= has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  def []=(key, value)
                    key = key.to_sym
                    k_str = key.to_s
                    if value.nil?
                      unless @table[key].nil?
              Severity: Minor
              Found in lib/neography/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

              Method batch_create_unique_relationship has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                    def batch_create_unique_relationship(index, key, value, type, from, to, props = nil)
              Severity: Major
              Found in lib/neography/rest/batch.rb - About 50 mins to fix

                Method create_unique_relationship has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                      def create_unique_relationship(index, key, value, type, from, to, props = nil)
                Severity: Major
                Found in lib/neography/rest/relationship_indexes.rb - About 50 mins to fix

                  Method create_unique has 7 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                        def create_unique(index, key, value, type, from_node, to_node, props = nil)
                  Severity: Major
                  Found in lib/neography/relationship.rb - About 50 mins to fix

                    Method get_shortest_weighted_path has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                          def get_shortest_weighted_path(from, to, relationships, weight_attribute = "weight", depth = 1, algorithm = "dijkstra")
                    Severity: Minor
                    Found in lib/neography/rest/node_paths.rb - About 45 mins to fix

                      Method return_result has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def return_result(response, code, body, parsed, path, query_body)
                      Severity: Minor
                      Found in lib/neography/connection.rb - About 45 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language