cityway-transdev/activeroad

View on GitHub

Showing 31 of 33 total issues

File osm_pbf_importer_level_db.rb has 566 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'leveldb-native'
require 'csv'

module ActiveRoad
  class OsmPbfImporterLevelDb
Severity: Major
Found in app/models/active_road/osm_pbf_importer_level_db.rb - About 1 day to fix

    Method split_way_with_boundaries has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
    Open

        def split_way_with_boundaries
          Rails.logger.info "Begin to split and affect boundaries to ways in PostgreSql"
          start = Time.now
    
          # Update physical roads entirely contains in boundaries
    Severity: Minor
    Found in app/models/active_road/osm_pbf_importer_level_db.rb - About 1 day 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 backup_relations_pgsql has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
    Open

        def backup_relations_pgsql
          Rails.logger.info "Begin to backup relations in PostgreSql"
          start = Time.now
          relations_parser = ::PbfParser.new(pbf_file)
          boundaries_counter = 0
    Severity: Minor
    Found in app/models/active_road/osm_pbf_importer_level_db.rb - About 7 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 update_nodes_with_way has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
    Open

        def update_nodes_with_way
          Rails.logger.info "Update way in nodes in LevelDB"
          start = Time.now
          ways_parser = ::PbfParser.new(pbf_file)
          ways_counter = 0 
    Severity: Minor
    Found in app/models/active_road/osm_pbf_importer_level_db.rb - About 5 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 split_way_with_boundaries has 106 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def split_way_with_boundaries
          Rails.logger.info "Begin to split and affect boundaries to ways in PostgreSql"
          start = Time.now
    
          # Update physical roads entirely contains in boundaries
    Severity: Major
    Found in app/models/active_road/osm_pbf_importer_level_db.rb - About 4 hrs to fix

      Class OsmPbfImporterLevelDb has 30 methods (exceeds 20 allowed). Consider refactoring.
      Open

        class OsmPbfImporterLevelDb
          include OsmPbfImporter
      
          @@csv_batch_size = 100000
          cattr_reader :csv_batch_size
      Severity: Minor
      Found in app/models/active_road/osm_pbf_importer_level_db.rb - About 3 hrs to fix

        Method backup_ways has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

            def backup_ways
              Rails.logger.info "Begin to backup ways in LevelDB"
              start = Time.now
              ways_parser = ::PbfParser.new(pbf_file)
              ways_counter = 0 
        Severity: Minor
        Found in app/models/active_road/osm_pbf_importer_level_db.rb - About 3 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 join_ways has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            def join_ways(ways)
              closed_ways = []
              endpoints_to_ways = EndpointToWayMap.new
              for way in ways
                if way.closed?
        Severity: Minor
        Found in app/models/active_road/osm_pbf_importer.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 refresh_context has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

          def refresh_context( node, context = {} )
            context_uphill = context[:uphill] ? context[:uphill] : 0
            context_downhill = context[:downhill] ? context[:downhill] : 0
            context_height = context[:height] ? context[:height] : 0
        
        
        Severity: Minor
        Found in lib/active_road/shortest_path/finder.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 iterate_ways has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

            def iterate_ways
              Rails.logger.info "Begin to backup ways in PostgreSql"
              start = Time.now
           
              ways_counter = 0
        Severity: Minor
        Found in app/models/active_road/osm_pbf_importer_level_db.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 backup_logical_roads_pgsql has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

            def backup_logical_roads_pgsql
              Rails.logger.info "Begin to backup logical roads in PostgreSql"
              start = Time.now
              logical_roads_counter = 0
        
        
        Severity: Minor
        Found in app/models/active_road/osm_pbf_importer_level_db.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 backup_relations_pgsql has 56 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def backup_relations_pgsql
              Rails.logger.info "Begin to backup relations in PostgreSql"
              start = Time.now
              relations_parser = ::PbfParser.new(pbf_file)
              boundaries_counter = 0
        Severity: Major
        Found in app/models/active_road/osm_pbf_importer_level_db.rb - About 2 hrs to fix

          Method iterate_nodes has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              def iterate_nodes
                Rails.logger.debug "Begin to backup nodes in PostgreSql"
          
                start = Time.now
                nodes_counter = street_numbers_counter = 0
          Severity: Minor
          Found in app/models/active_road/osm_pbf_importer_level_db.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 initialize has 13 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                def initialize(id, nodes = [], car = false, bike = false, train = false, pedestrian = false, name = "", maxspeed = 0, oneway = false, boundary = "", admin_level = "", addr_housenumber = "", options = {})
          Severity: Major
          Found in app/models/active_road/osm_pbf_importer.rb - About 1 hr to fix

            Method iterate_ways has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def iterate_ways
                  Rails.logger.info "Begin to backup ways in PostgreSql"
                  start = Time.now
               
                  ways_counter = 0
            Severity: Minor
            Found in app/models/active_road/osm_pbf_importer_level_db.rb - About 1 hr to fix

              Method save_physical_road_conditionnal_costs_and_junctions has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  def save_physical_road_conditionnal_costs_and_junctions
                    Rails.logger.info "Begin to backup ways in PostgreSql"
                    
                    start = Time.now
                    physical_road_conditionnal_costs_counter = junctions_physical_roads_counter = 0
              Severity: Minor
              Found in app/models/active_road/osm_pbf_importer_level_db.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 update_nodes_with_way has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def update_nodes_with_way
                    Rails.logger.info "Update way in nodes in LevelDB"
                    start = Time.now
                    ways_parser = ::PbfParser.new(pbf_file)
                    ways_counter = 0 
              Severity: Minor
              Found in app/models/active_road/osm_pbf_importer_level_db.rb - About 1 hr to fix

                Method iterate_nodes has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def iterate_nodes
                      Rails.logger.debug "Begin to backup nodes in PostgreSql"
                
                      start = Time.now
                      nodes_counter = street_numbers_counter = 0
                Severity: Minor
                Found in app/models/active_road/osm_pbf_importer_level_db.rb - About 1 hr to fix

                  Method save_physical_road_conditionnal_costs_and_junctions has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def save_physical_road_conditionnal_costs_and_junctions
                        Rails.logger.info "Begin to backup ways in PostgreSql"
                        
                        start = Time.now
                        physical_road_conditionnal_costs_counter = junctions_physical_roads_counter = 0
                  Severity: Minor
                  Found in app/models/active_road/osm_pbf_importer_level_db.rb - About 1 hr to fix

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

                          def initialize(boundary_id, old_physical_road_id, old_physical_road_objectid, old_physical_road_tags, old_physical_road_geometry, old_departure_objectid, old_departure_geometry, old_arrival_objectid, old_arrival_geometry, geometry)
                    Severity: Major
                    Found in app/models/active_road/osm_pbf_importer_level_db.rb - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language