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 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 join_ways
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def join_ways(ways)
closed_ways = []
endpoints_to_ways = EndpointToWayMap.new
for way in ways
if way.closed?
Method initialize
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(id, lon, lat, addr_housenumber = "", ways = [], end_of_way = false, tags = {} )
Method physical_road_conditionnal_costs
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def physical_road_conditionnal_costs(way)
[].tap do |prcc|
prcc << [ "car", Float::MAX] if !way.car
prcc << [ "pedestrian", Float::MAX] if !way.pedestrian
prcc << [ "bike", Float::MAX] if !way.bike
- 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_way
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def join_way(way, other)
if way.closed?
raise StandardError, "Trying to join a closed way to another"
end
if other.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"