pygae/galgebra

View on GitHub

Showing 155 of 899 total issues

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

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

    def Dictionary_to_Matrix(dict_rep, ga):
        """Returns the matrix representation of that linear transformation on
        geometric algebra ga which has dictionary representation dict_rep."""
        # columns[j] is a list of the entries in the matrix's jth column.
        # columns[j][i] is the (i,j)th entry in the matrix.
    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 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

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

            def reflect_in_blade(self, blade: 'Mv') -> 'Mv':  # Reflect mv in blade
                # See Mv class functions documentation
                if blade.is_blade():
                    self.characterise_Mv()
                    blade.characterise_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 __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def __init__(self, *args, ga: 'Ga', recp=None, coords=None, **kwargs):
        Severity: Minor
        Found in galgebra/mv.py - About 35 mins to fix

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

              def setup(basis, metric=None, coords=None, rframe=False, debug=False, curv=(None, None)) -> list:
          Severity: Minor
          Found in galgebra/deprecated.py - About 35 mins to fix

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

                    def _repr_latex_(self):
                        f = None
                        try:
                            # This isn't perfect, in principle there could be multiple
                            # active IPython's with different configurations.
            Severity: Minor
            Found in galgebra/_utils/printable.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 __init__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def __init__(self, *args):
                    if len(args) == 1:
                        if isinstance(args[0], Symbol):
                            self.__init_from_symbol(*args)
                        elif isinstance(args[0], (list, tuple)):
            Severity: Minor
            Found in galgebra/dop.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 abs_with_hint has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def abs_with_hint(expr, hint: str = '0') -> Expr:
                """
                Heuristics for simplifying the absolute value of an expression with hints.
                """
            
            
            Severity: Minor
            Found in galgebra/metric.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 Add has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def Add(sdop1, sdop2):
                    if isinstance(sdop1, Sdop) and isinstance(sdop2, Sdop):
                        return Sdop(_merge_terms(sdop1.terms, sdop2.terms))
                    else:
                        # convert values to multiplicative operators
            Severity: Minor
            Found in galgebra/dop.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 _unparse_paren has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def _unparse_paren(level_lst):
                line = level_lst[0][0][0]
                for level in level_lst[1:]:
                    for group in level:
                        new_string = group[-1]
            Severity: Minor
            Found in galgebra/_utils/parser.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 _print_Derivative has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def _print_Derivative(self, expr):
                    # Break the following to support both py 2 & 3
                    # function, *diff_args = expr.args
                    function = expr.args[0]
                    diff_args = expr.args[1:]
            Severity: Minor
            Found in galgebra/printer.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 _consolidate_terms has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def _consolidate_terms(terms):
                """
                Remove zero coefs and consolidate coefs with repeated pdiffs.
                """
                new_coefs = []
            Severity: Minor
            Found in galgebra/dop.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 printrref has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def printrref(matrix, vars="xyzuvwrs"):   # Print rref of matrix with variables.
                rrefmatrix = matrix.rref()[0]
                rows, cols = rrefmatrix.shape
                if len(vars) < cols - 1:
                    print('Not enough variables.')
            Severity: Minor
            Found in galgebra/mv.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 lt_M
            Severity: Major
            Found in galgebra/lt.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return A > B
              Severity: Major
              Found in galgebra/mv.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                                return sgn * result * self._ga.indexes_to_blades_dict[tuple(index)]
                Severity: Major
                Found in galgebra/ga.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                              return mv.Mv(lt_M, ga=self.Ga)
                  Severity: Major
                  Found in galgebra/lt.py - About 30 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language