TrishGillett/pysdpt3glue

View on GitHub
sdpt3glue/sedumi_writer.py

Summary

Maintainability
C
1 day
Test Coverage

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

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 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

        There are no issues that match your filters.

        Category
        Status