Showing 79 of 82 total issues
Function diff_plot
has a Cognitive Complexity of 19 (exceeds 15 allowed). Consider refactoring. Open
def diff_plot(
motifs,
pwms,
names,
freq,
- 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 abs(matrix[i][n]) * height >= 0.5:
plt.text(
x,
y,
nuc,
Avoid deeply nested control flow statements. Open
if len(res):
for _, gene_name, _, gene_id, *_ in res:
motif_set = True
if gene_name is not None:
f.write(f"{motif}\t{gene_name}\tOrthologs\tN\n")
Avoid deeply nested control flow statements. Open
if "x" not in line and "n" not in line:
line = line.strip().upper()
align.append(line)
if not pfm:
pfm = [[0 for _ in range(4)] for _ in range(len(line))]
Avoid deeply nested control flow statements. Open
with open(score_file) as f:
for line in f:
l1, l2, m, sd = line.strip().split("\t")[:4]
self.scoredist[metric][f"{match}_{combine}"].setdefault(
int(l1), {}
Avoid deeply nested control flow statements. Open
if not pfm:
pfm = [[0 for x in range(4)] for x in range(len(match))]
for pos in range(len(match)):
Function matrix_ic
has a Cognitive Complexity of 18 (exceeds 15 allowed). Consider refactoring. Open
def matrix_ic(self, ppm1, ppm2, bg=None):
if bg is None:
bg = [0.25, 0.25, 0.25, 0.25]
# xxCATGYT
- 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 not pfm:
pfm = [[0 for x in range(4)] for x in range(len(match))]
for pos in range(len(match)):
Avoid deeply nested control flow statements. Open
for pos in range(len(match)):
if match[pos] in nucs:
pfm[pos][nucs[match[pos]]] += 1
else:
for i in range(4):
Function _read_motifs_pfm
has a Cognitive Complexity of 18 (exceeds 15 allowed). Consider refactoring. Open
def _read_motifs_pfm(handle):
p = re.compile(
r"(\d+(\.\d+)?(e-\d+)?)\s+(\d+(\.\d+)?(e-\d+)?)\s+(\d+(\.\d+)?(e-\d+)?)\s+(\d+(\.\d+)?(e-\d+)?)" # noqa: E501
)
motifs = []
- 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
for pos in range(len(match)):
if match[pos] in nucs:
pfm[pos][nucs[match[pos]]] += 1
else:
for i in range(4):
Avoid deeply nested control flow statements. Open
if warn_no_summit:
logger.warning(
"No summit present in narrowPeak file, "
"using the peak center."
)
Function _upgrade_config
has a Cognitive Complexity of 18 (exceeds 15 allowed). Consider refactoring. Open
def _upgrade_config(self, config_fname=None):
changed = False
dflt = configparser.ConfigParser()
dflt.read(self.default_config)
- 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 len(vals) > 5:
strand = vals[5]
Avoid deeply nested control flow statements. Open
if m1 not in scores:
scores[m1] = {}
scores[m1][m2] = s
Avoid deeply nested control flow statements. Open
if len(row) == 4:
row = [float(x) for x in row]
pfm.append(row)
Function plot_logo
has a Cognitive Complexity of 17 (exceeds 15 allowed). Consider refactoring. Open
def plot_logo(
self,
fname=None,
kind="information",
title=True,
- 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.max_partial(m1.pfm, m2.pfm, metric, combine)
Avoid too many return
statements within this function. Open
return self.max_subtotal(m1.pfm, m2.pfm, metric, combine)
Avoid too many return
statements within this function. Open
return "unknown"