Showing 283 of 899 total issues
Avoid too many return
statements within this function. Open
return mv.Mv(root, *args, **kwargs)
Avoid too many return
statements within this function. Open
return lt_M
Avoid too many return
statements within this function. Open
return self.Mul(er, blade, mode=mode)
Avoid too many return
statements within this function. Open
return (0, A)
Avoid too many return
statements within this function. Open
return selfxA.blade_rep()
Avoid too many return
statements within this function. Open
return Mv(self.Ga.mul(self.obj, A.obj), ga=self.Ga)
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:
- Read upRead up
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
"""
- Read upRead up
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
- Read upRead up
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):
- Read upRead up
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()
- Read upRead up
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):
- Read upRead up
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)
- Read upRead up
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('_')
- Read upRead up
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):
- Read upRead up
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):
- Read upRead up
- Exclude checks
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):
- Read upRead up
- Exclude checks
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'):
- Read upRead up
- Exclude checks
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'):
- Read upRead up
- Exclude checks
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
- Read upRead up
- Exclude checks
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.