pygae/galgebra

View on GitHub

Showing 157 of 843 total issues

Function collect has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def collect(self, deep=False) -> 'Mv':
        """
        group coeffients of blades of multivector
        so there is only one coefficient per grade
        """
Severity: Minor
Found in galgebra/mv.py - About 55 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 is_blade has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def is_blade(self) -> bool:
        """
        True is self is blade, otherwise False
        sets self.blade_flg and returns value
        """
Severity: Minor
Found in galgebra/mv.py - About 55 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 _eval_derivative_n_times_terms has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def _eval_derivative_n_times_terms(terms, x, n):
    for i in range(n):
        new_terms = []
        for k, term in enumerate(terms):
            dc = _basic_diff(term[0], x)
Severity: Minor
Found in galgebra/dop.py - About 55 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 deeply nested control flow statements.
Open

                        if self.cmpflg:
                            s += str_sdop + '*' + str_base
                        else:
                            s += '-' + str_base + '*' + str_sdop[1:]
                    else:
Severity: Major
Found in galgebra/mv.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        if _contains_interval(group, group_down):
                            level_lst[ilevel][igroup].append(igroup_down)
                        igroup_down += 1
    Severity: Major
    Found in galgebra/_utils/parser.py - About 45 mins to fix

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

          def connection(self, rbase, key_base, mode, left):
              """
              Compute required multivector connections of the form
              (Einstein summation convention) :math:`e^{j}*(D_{j}e_{i_{1}...i_{r}})`
              and :math:`(D_{j}e_{i_{1}...i_{r}})*e^{j}` where :math:`*` could be
      Severity: Minor
      Found in galgebra/ga.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

      Avoid deeply nested control flow statements.
      Open

                          if not f:
                              mat[row, col] = Symbol(element, real=True)
                          else:
                              mat[row, col] = Function(element)(*coords)
      
      
      Severity: Major
      Found in galgebra/lt.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if self.cmpflg:
                                    s += str_sdop + '*' + str_base
                                else:
                                    s += str_base + '*' + str_sdop
                    s += ' + '
        Severity: Major
        Found in galgebra/mv.py - About 45 mins to fix

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

              def __call__(self, *args):
                  """
                  Evaluate the multilinear function for the given vector arguments.
                  Note that a sympy scalar is returned, *not* a multilinear function.
                  """
          Severity: Minor
          Found in galgebra/lt.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 _arithmetic_op has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def _arithmetic_op(self, A, op, name: str):
                  """ Common implementation for + and - """
                  if isinstance(A, dop._BaseDop):
                      return NotImplemented
          
          
          Severity: Minor
          Found in galgebra/mv.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

          Avoid deeply nested control flow statements.
          Open

                                  for l in ga.n_range:
                                      s += dxdu[k][i] * dxdu[l][j] * g_base[k, l].subs(sub_pairs)
                              g[i, j] = trigsimp(s)
          Severity: Major
          Found in galgebra/ga.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if x != S.Zero:
                                        dA += reduce(operator.mul, c, x)
            
            
            Severity: Major
            Found in galgebra/ga.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  if row <= col:
                                      element = root + pos + row_index + col_index
                                  else:
                                      element = root + pos + col_index + row_index
                                  if not f:
              Severity: Major
              Found in galgebra/lt.py - About 45 mins to fix

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

                    def Mul(A: 'Mv', B: 'Mv', op: str) -> 'Mv':
                        """
                        Function for all types of geometric multiplications called by
                        overloaded operators for ``*``, ``^``, ``|``, ``<``, and ``>``.
                        """
                Severity: Minor
                Found in galgebra/mv.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 printGS has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                def printGS(M, norm=False):  # Print Gram-Schmidt output.
                    from sympy import GramSchmidt
                    global N
                    N = GramSchmidt(M, norm)
                    result = '[ '
                Severity: Minor
                Found in galgebra/mv.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

                Avoid deeply nested control flow statements.
                Open

                                        if self.cmpflg:
                                            s += r'\left ( ' + str_sdop + r'\right ) ' + str_base
                                        else:
                                            s += str_base + ' ' + r'\left ( ' + str_sdop + r'\right ) '
                                    else:
                Severity: Major
                Found in galgebra/mv.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          for i in range(len(g)):
                                              m[i, i] = g[i]
                                          self.g = m
                  Severity: Major
                  Found in galgebra/metric.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                        if row <= col:
                                            sign = S.One
                                            element = root + pos + row_index + col_index
                                        else:
                                            sign = -S.One
                    Severity: Major
                    Found in galgebra/lt.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                          if not f:
                                              mat[row, col] = sign * Symbol(element, real=True)
                                          else:
                                              mat[row, col] = sign * Function(element)(*coords)
                              else:
                      Severity: Major
                      Found in galgebra/lt.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                if index in terms:
                                                    c_tmp, base, g_keys = terms[index]
                                                    terms[index] = (c_tmp + c, base, g_keys)
                                                else:
                                                    terms[index] = (c, base, grade_keys[base])
                        Severity: Major
                        Found in galgebra/mv.py - About 45 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language