jmarca/initial-solution

View on GitHub
src/solution_output.py

Summary

Maintainability
D
2 days
Test Coverage
F
45%

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
Severity: Minor
Found in src/solution_output.py - About 6 hrs to fix

    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,
    Severity: Minor
    Found in src/solution_output.py - About 6 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

    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,
    Severity: Minor
    Found in src/solution_output.py - 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

    Function print_solution has 10 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def print_solution(demand,
    Severity: Major
    Found in src/solution_output.py - About 1 hr to fix

      Function csv_demand_output has 9 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def csv_demand_output(demand,
      Severity: Major
      Found in src/solution_output.py - About 1 hr to fix

        Function csv_output has 9 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def csv_output(demand,
        Severity: Major
        Found in src/solution_output.py - About 1 hr to fix

          Function print_initial_solution has 8 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def print_initial_solution(demand,
          Severity: Major
          Found in src/solution_output.py - About 1 hr to fix

            Function csv_output has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def csv_output(demand,
                           dist_matrix,
                           time_matrix,
                           vehicles,
                           manager,
            Severity: Minor
            Found in src/solution_output.py - About 35 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

            There are no issues that match your filters.

            Category
            Status