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
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
- Read upRead up
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
- Read upRead up
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
- Read upRead up
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
Class OsmPbfImporterLevelDb
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class OsmPbfImporterLevelDb
include OsmPbfImporter
@@csv_batch_size = 100000
cattr_reader :csv_batch_size
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
- Read upRead up
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?
- Read upRead up
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
- Read upRead up
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
- Read upRead up
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
- Read upRead up
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
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
- Read upRead up
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 = {})
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
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
- Read upRead up
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
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
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
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)