pygae/galgebra

View on GitHub

Showing 283 of 899 total issues

Avoid too many return statements within this function.
Open

        return mv.Mv(root, *args, **kwargs)
Severity: Major
Found in galgebra/ga.py - About 30 mins to fix

    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 self.Mul(er, blade, mode=mode)
      Severity: Major
      Found in galgebra/ga.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                            return (0, A)
        Severity: Major
        Found in galgebra/ga.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return selfxA.blade_rep()
          Severity: Major
          Found in galgebra/mv.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return Mv(self.Ga.mul(self.obj, A.obj), ga=self.Ga)
            Severity: Major
            Found in galgebra/mv.py - About 30 mins to fix

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

              def parse_line(line: str, op_order: List[str]) -> str:
                  line = line.replace(' ', '')
                  level_lst = _parse_paren(line)
                  ilevel = 0
                  for level in level_lst:
              Severity: Minor
              Found in galgebra/_utils/parser.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 Christoffel_symbols has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def Christoffel_symbols(self, mode=1):
                      """
                      mode = 1  Christoffel symbols of the first kind
                      mode = 2  Christoffel symbols of the second kind
                      """
              Severity: Minor
              Found in galgebra/metric.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 blade_reduce has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def blade_reduce(lst: List[int]) -> Tuple[int, Optional[List[int]]]:
                      """
                      Reduce wedge product of basis vectors to normal order.
              
                      `lst` is a list of indicies of basis vectors.  blade_reduce sorts the list
              Severity: Minor
              Found in galgebra/ga.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 base_expansion_dict has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def base_expansion_dict(self) -> OrderedDict[Symbol, Expr]:
                      """ dictionary expanding base basis in terms of blade basis """
                      base_expansion_dict = OrderedDict()
              
                      for base, blade, index in zip(self.bases.flat, self.blades.flat, self.indexes.flat):
              Severity: Minor
              Found in galgebra/ga.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 blade_expansion_dict has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def blade_expansion_dict(self) -> OrderedDict[Symbol, Expr]:
                      """ dictionary expanding blade basis in terms of base basis """
              
                      blade_expansion_dict = OrderedDict()
              
              
              Severity: Minor
              Found in galgebra/ga.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 grades has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def grades(self, A: Expr) -> List[int]:  # Return list of grades present in A
                      A = self.base_to_blade_rep(A)
                      A = expand(A)
                      blades = set()
                      if isinstance(A, Add):
              Severity: Minor
              Found in galgebra/ga.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 Mul has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def Mul(self, A: Expr, B: Expr, mode: str = '*') -> Expr:  # Unifies all products into one function
                      if mode == '*':
                          return self.mul(A, B)
                      elif mode == '^':
                          return self.wedge(A, B)
              Severity: Minor
              Found in galgebra/ga.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 _split_name has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _split_name(self):
                      sub_str = []
                      root_str = []
                      for basis_vec in self.args:
                          split_lst = basis_vec.name.split('_')
              Severity: Minor
              Found in galgebra/atoms.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 flatten has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def flatten(x):
                  result = []
              
                  for el in x:
                      if isinstance(x, collections.Iterable) and not isstr(el):
              Severity: Minor
              Found in galgebra/utils.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

              Method "__init__" has 8 parameters, which is greater than the 7 authorized.
              Open

                  def __init__(self, __u, __coords, *, ga, norm=False, name=None, root='e', debug=False):
              Severity: Major
              Found in galgebra/ga.py by sonar-python

              A long parameter list can indicate that a new structure should be created to wrap the numerous parameters or that the function is doing too many things.

              Noncompliant Code Example

              With a maximum number of 4 parameters:

              def do_something(param1, param2, param3, param4, param5):
                  ...
              

              Compliant Solution

              def do_something(param1, param2, param3, param4):
                  ...
              

              Refactor this function to reduce its Cognitive Complexity from 33 to the 15 allowed.
              Open

                  def __init__(self, __u, __coords, *, ga, norm=False, name=None, root='e', debug=False):
              Severity: Critical
              Found in galgebra/ga.py by sonar-python

              Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

              See

              Refactor this function to reduce its Cognitive Complexity from 50 to the 15 allowed.
              Open

              def Symbolic_Matrix(kernel, coords=None, f=False, mode='g'):
              Severity: Critical
              Found in galgebra/lt.py by sonar-python

              Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

              See

              Refactor this function to reduce its Cognitive Complexity from 34 to the 15 allowed.
              Open

                  def __init__(self, *args, ga, f=False, mode='g'):
              Severity: Critical
              Found in galgebra/lt.py by sonar-python

              Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

              See

              Refactor this function to reduce its Cognitive Complexity from 30 to the 15 allowed.
              Open

                  def Mul(dopl, dopr, op='*'):  # General multiplication of Dop's
              Severity: Critical
              Found in galgebra/mv.py by sonar-python

              Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

              See

              Severity
              Category
              Status
              Source
              Language