Showing 29 of 40 total issues
Function insert_nodes_for_breaks
has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring. Open
def insert_nodes_for_breaks(self,travel_times):
"""Use travel time matrix, pickup and dropoff pairs to create the
necessary dummy nodes for modeling breaks between pairs of nodes.
"""
- 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
File solution_output.py
has 451 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Solution output routines"""
from six.moves import xrange
from datetime import datetime, timedelta
import pandas as pd
import math
Function print_solution
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
def print_solution(demand,
dist_matrix,
time_matrix,
vehicles,
manager,
- 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
Function csv_demand_output
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def csv_demand_output(demand,
dist_matrix,
time_matrix,
vehicles,
manager,
- 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
Function initial_routes_no_breaks
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def initial_routes_no_breaks(demand,vehicles,time_matrix,
debug=False):
# initial routes should be a list of nodes to visit, in node space
# (not solver index space, not map space)
- 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
File demand.py
has 293 lines of code (exceeds 250 allowed). Consider refactoring. Open
import pandas as pd
import numpy as np
import breaks
import break_node as BN
import math
Function create_short_break_callback
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def create_short_break_callback(travel_minutes_matrix,
demand,
period,
break_time):
"""create a callback function for short_breaktime. presumes that
- 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
Function main
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def main():
"""Entry point of the program."""
parser = argparse.ArgumentParser(description='Solve assignment of truck load routing problem, give hours of service rules and a specified list of origins and destinations')
# parser.add_argument('--resume_file',type=str,dest='resumefile',
# help="resume a failed solver run from this file")
Function main
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def main():
"""Entry point of the program."""
parser = argparse.ArgumentParser(description='Solve assignment of truck load routing problem, with specified list of origins and destinations, ignoring hours of service rules')
# parser.add_argument('--resume_file',type=str,dest='resumefile',
# help="resume a failed solver run from this file")
Function __init__
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def __init__(self,
odpairs,
time_matrix,
horizon,
pickup_time=15,
Function print_solution
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def print_solution(demand,
Function create_drive_callback
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def create_drive_callback(travel_minutes_matrix,
demand,
period,
break_time):
"""create a callback function for drivetime. presumes that
- 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
Function __init__
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self,
Function csv_demand_output
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def csv_demand_output(demand,
Function csv_output
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def csv_output(demand,
Function decide_next
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def decide_next(d,t,accumulators,od):
# decide where to go next
# first, can get to goal?
if goal_okay(d,t,accumulators,od):
return move_to_goal(d,t,accumulators,od)
- 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
Function print_initial_solution
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def print_initial_solution(demand,
Function __init__
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self,
Function break_constraint
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def break_constraint(self,
Function model_run
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def model_run(d,t,v,base_value,