maxdemarzi/neography

View on GitHub

Showing 49 of 49 total issues

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

      def add_relationship_to_index(index, key, value, id, unique = false)
        options = {
          :body => (
            { :uri   => @connection.configuration + "/relationship/#{get_id(id)}",
              :key   => key,
Severity: Minor
Found in lib/neography/rest/relationship_indexes.rb and 1 other location - About 45 mins to fix
lib/neography/rest/node_indexes.rb on lines 31..42

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 40.

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 initialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def initialize(hash=nil)
      @table = {}
      unless hash.nil?
        if hash["self"] # coming from REST API
          @neo_id = hash["self"].split('/').last
Severity: Minor
Found in lib/neography/property_container.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 raise_errors has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def raise_errors(code, exception, message, stacktrace, request, index)
Severity: Minor
Found in lib/neography/connection.rb - About 45 mins to fix

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

          def add_node_to_index(index, key, value, id, unique = false)
            options = {
              :body => (
                { :uri   => @connection.configuration + "/node/#{get_id(id)}",
                  :key   => key,
    Severity: Minor
    Found in lib/neography/rest/node_indexes.rb and 1 other location - About 45 mins to fix
    lib/neography/rest/relationship_indexes.rb on lines 31..42

    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 40.

    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 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 initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def initialize(from, to, algorithm, all=false, types = nil, dir = "all" )
      Severity: Minor
      Found in lib/neography/path_traverser.rb - About 45 mins to fix

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

              Zip::File.open('neo4j-spatial.zip') do |zip_file|
                zip_file.each do |f|
                 f_path=File.join("neo4j/plugins/", f.name)
                 FileUtils.mkdir_p(File.dirname(f_path))
                 begin
        Severity: Minor
        Found in lib/neography/tasks.rb and 1 other location - About 40 mins to fix
        lib/neography/tasks.rb on lines 31..38

        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 38.

        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

                Zip::File.open('neo4j.zip') do |zip_file|
                  zip_file.each do |f|
                   f_path=File.join(".", f.name)
                   FileUtils.mkdir_p(File.dirname(f_path))
                   begin
        Severity: Minor
        Found in lib/neography/tasks.rb and 1 other location - About 40 mins to fix
        lib/neography/tasks.rb on lines 215..222

        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 38.

        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 create_unique has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def self.create_unique(index, key, value, props = nil, db = Neography::Rest.new)
        Severity: Minor
        Found in lib/neography/node.rb - About 35 mins to fix

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

                def batch_add_node_to_index(index, key, value, id, unique = false)
          Severity: Minor
          Found in lib/neography/rest/batch.rb - About 35 mins to fix

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

                  def path_options(to, relationships, depth, algorithm, extra_body = {})
            Severity: Minor
            Found in lib/neography/rest/node_paths.rb - About 35 mins to fix

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

                    def get_path(from, to, relationships, depth = 1, algorithm = "shortestPath")
              Severity: Minor
              Found in lib/neography/rest/node_paths.rb - About 35 mins to fix

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

                      def remove_from_index_path(klass, index, key_or_id, value_or_id = nil, id = nil)
                Severity: Minor
                Found in lib/neography/rest/batch.rb - About 35 mins to fix

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

                        def add_relationship_to_index(index, key, value, id, unique = false)
                  Severity: Minor
                  Found in lib/neography/rest/relationship_indexes.rb - About 35 mins to fix

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

                          def find_geometries_in_bbox(layer, minx, maxx, miny, maxy)
                    Severity: Minor
                    Found in lib/neography/rest/spatial.rb - About 35 mins to fix

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

                            def add_node_to_index(index, key, value, id, unique = false)
                      Severity: Minor
                      Found in lib/neography/rest/node_indexes.rb - About 35 mins to fix

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

                            def initialize(message = nil, code = nil, stacktrace = nil, request = nil, index = 0)
                        Severity: Minor
                        Found in lib/neography/errors.rb - About 35 mins to fix

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

                                def batch_find_geometries_in_bbox(layer, minx, maxx, miny, maxy)
                          Severity: Minor
                          Found in lib/neography/rest/batch.rb - About 35 mins to fix

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

                                def handle_4xx_500_response(response, code, body, path, query_body)
                            Severity: Minor
                            Found in lib/neography/connection.rb - About 35 mins to fix

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

                                    def get_paths(from, to, relationships, depth = 1, algorithm = "allPaths")
                              Severity: Minor
                              Found in lib/neography/rest/node_paths.rb - About 35 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language