Showing 18 of 24 total issues
Matrix
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
class Matrix(BaseMatrix):
def __init__(self, matrix):
super().__init__(matrix)
def shape(self):
Function test_miller_rabin
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def test_miller_rabin(self, precision):
"""Tests prime with miller-rabin algorithm
:param precision: number of rounds to perform
:return: True iff probably prime
- 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 _get_modules
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _get_modules(path):
"""Finds modules in folder recursively
:param path: directory
:return: list of modules
- 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 ls_recurse
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def ls_recurse(path, include_hidden=False):
"""Finds content of folder recursively
:param path: directory to get list of files and folders
:param include_hidden: True iff include hidden files in 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 prettify
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def prettify(name, blank=" "):
"""Prettify name of path
:param name: path Name: to edit
:param blank: default blanks in name
- 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
Avoid deeply nested control flow statements. Open
if i == t - 1:
return False
else:
i += 1
v = (v ** 2) % self.to_int
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 __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self,
Function plot_type
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def plot_type(self, func, mins, maxs, precision, kind):
Function solve
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def solve(self, table_size):
"""Solves problem
:param table_size: Size of table
:return: List of possible solutions
- 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 get_number
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_number(self, question, min_i=float("-inf"), max_i=float("inf"),
just_these=None):
"""Parses answer and gets number
:param question: Question: to ask user
- 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 increase
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def increase(self, amount=1):
if self.levels.head.val.increase(amount):
return True
# head cannot increase -> reset and check for carry
- 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 get_last
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_last(weekday, including_today=False):
"""Gets last day of week
:param weekday: day of week
:param including_today: If today is sunday and requesting last sunday
- 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
Avoid too many return
statements within this function. Open
return self.get_yes_no(self.last_question)
Avoid too many return
statements within this function. Open
return False
Avoid too many return
statements within this function. Open
return 0, 0 # stay here
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"
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"