Matrix
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
class Matrix(BaseMatrix):
def __init__(self, matrix):
super().__init__(matrix)
def shape(self):
Function __eq__
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def __eq__(self, other):
if isinstance(other, list):
other = Matrix(other)
if self.shape() != other.shape():
- 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 is_diagonally_dominant
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def is_diagonally_dominant(self, strictly=False):
for i, row in enumerate(self.m):
diagonal_element = row[0, i]
sum_of_others = np.sum(row) - diagonal_element
- 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 check_on
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def check_on(self, f):
for row in range(self.get_n_rows()):
for col in range(self.get_n_cols()):
element = self.get_at(row, col)
if not f(element):
- 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"