pygae/galgebra

View on GitHub

Showing 155 of 899 total issues

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

def xpdf(filename=None, paper=(14, 11), crop=False, png=False, prog=False, debug=False, pt='10pt', pdfprog='pdflatex'):
Severity: Major
Found in galgebra/printer.py - About 1 hr to fix

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

        def __init__(self, __u, __coords, *, ga, norm=False, name=None, root='e', debug=False):
    Severity: Major
    Found in galgebra/ga.py - About 1 hr to fix

      Consider simplifying this complex logical expression.
      Open

              if expr.exp.is_Rational and abs(expr.exp.p) == 1 and expr.exp.q != 1:
                  #base = self._print(expr.base)
                  expq = expr.exp.q
      
                  if expq == 2:
      Severity: Major
      Found in galgebra/printer.py - About 1 hr to fix

        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 _latex has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def _latex(self, print_obj):
                parts = []
                for base in self.Ga.basis:           # base is a basis symbol
                    if self.versor:
                        b = mv.Mv(base, ga=self.Ga)  # b is the corresponding basis vector
        Severity: Minor
        Found in galgebra/lt.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

        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

        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

                                  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

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

                def _sympystr(self, print_obj):
            
                    if self.versor:    # ## GSG: changed `self.spinor` to `self.versor` ###
                        return 'R = ' + print_obj._print(self.V)
                    else:
            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

            Avoid deeply nested control flow statements.
            Open

                                    if str_sdop[0] == '-' and not isinstance(sdop.terms[0][0], Add):
                                        if self.cmpflg:
                                            s += str_sdop + str_base
                                        else:
                                            s += '-' + str_base + ' ' + str_sdop[1:]
            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

                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 __mul__ has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    def __mul__(self, A):
                        if isinstance(A, dop._BaseDop):
                            return NotImplemented
                
                        if not isinstance(A, Mv):
                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 _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

                                        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

                  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 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 '_' in name or '^' in name:
                                                name = r'\left ( ' + name + r'\right )^{' + exp + '}'
                                            else:
                                                name += '^{' + exp + '}'
                    
                    
                    Severity: Major
                    Found in galgebra/printer.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

                      Severity
                      Category
                      Status
                      Source
                      Language