TrishGillett/pysdpt3glue

View on GitHub

Showing 15 of 17 total issues

Function extract_X has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

def extract_X(msg):
    '''
    Given the output message from running SDPT3solve.m, reconstruct the X
    matrix from the printed output and return it.
    '''
Severity: Minor
Found in sdpt3glue/result.py - About 4 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 simplify_sedumi_model has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

def simplify_sedumi_model(A, b, c, K, allow_nonzero_b=False):
    '''
    Tries to eliminate variables using a few simple strategies:

    1. If a constraint is expressing :math:`A_{ki}x_i = b_k` where variable
Severity: Minor
Found in sdpt3glue/sedumi_writer.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 check_eliminatibility has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

def check_eliminatibility(g, h, n_elig=None, allow_nonzero_b=False):
    '''
    Tests if constraint :math:`gx = h` fits either pattern :math:`ax_i = d`
    or pattern :math:`ax_i + bx_j = d`, with the requirement that the
    :math:`x_i` variable be one of the first n_elig variables.
Severity: Minor
Found in sdpt3glue/sedumi_writer.py - 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

Avoid deeply nested control flow statements.
Open

                    for k, item in enumerate(re.split(r'\s+', line)):
                        Xlist[i][row, col_start + k] = float(item)
            print "Imported X[{0}] as a matrix with shape {1}.".format(i, Xlist[i].shape)
Severity: Major
Found in sdpt3glue/result.py - About 45 mins to fix

    Function sdpt3_solve_problem has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def sdpt3_solve_problem(
    Severity: Minor
    Found in sdpt3glue/solve.py - About 45 mins to fix

      Function track_and_return has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def track_and_return(self, jobid, pwd):
              '''
              Takes a jobid and password for a solve already in progress,
              waits for its status to change to 'Done', and returns the message,
              jobid, and password.
      Severity: Minor
      Found in sdpt3glue/solve_neos.py - About 45 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

      Function sdpt3_solve_mat has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def sdpt3_solve_mat(
      Severity: Minor
      Found in sdpt3glue/solve.py - About 35 mins to fix

        Function simplify_sedumi_model has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def simplify_sedumi_model(A, b, c, K, allow_nonzero_b=False):
        Severity: Minor
        Found in sdpt3glue/sedumi_writer.py - About 35 mins to fix

          Function write_sedumi_to_mat has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def write_sedumi_to_mat(A, b, c, K, target):
          Severity: Minor
          Found in sdpt3glue/sedumi_writer.py - About 35 mins to fix

            Function neos_solve has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def neos_solve(
            Severity: Minor
            Found in sdpt3glue/solve_neos.py - About 35 mins to fix

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

              def handle_msg_item(x):
                  '''
                  A function that takes a string x and returns it's interpretation as an int,
                  float, or string in that order of preference.  If x is None, None is
                  returned.
              Severity: Minor
              Found in sdpt3glue/result.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

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

              def clean_K_dims(K):
                  '''
                  Matlab requires the dimensions to be given in floating point numbers,
                  this checker ensures that they are.
                  '''
              Severity: Minor
              Found in sdpt3glue/sedumi_writer.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

              Avoid too many return statements within this function.
              Open

                  return None, None
              Severity: Major
              Found in sdpt3glue/sedumi_writer.py - About 30 mins to fix

                Function symmetrize_sedumi_model has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                def symmetrize_sedumi_model(A, b, c, K):
                    '''
                    Symmetrize sedumi model.
                    '''
                    colstart = K['f'] + K['l'] + sum(K['q'])
                Severity: Minor
                Found in sdpt3glue/sedumi_writer.py - About 25 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

                Function handle_submission has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                def handle_submission(matfile_target, no_prompt=False):
                    '''
                    Submits the Sedumi format .mat file to be solved on NEOS with SDPT3.
                
                    Args:
                Severity: Minor
                Found in sdpt3glue/solve_neos.py - About 25 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

                Severity
                Category
                Status
                Source
                Language