Showing 383 of 4,191 total issues
Avoid deeply nested control flow statements. Open
if masked == 0:
feature_dict[feature] = '0' # 0
elif masked == mask:
feature_dict[feature] = '+/-' # +/-
elif masked & pos_mask:
Function encode
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def encode(self, word: str) -> str:
r"""Return the Burrows-Wheeler transformed form of a word.
Parameters
----------
- 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 mode == 2:
self._ordered_tokens.append(new_token)
new_token = char
else:
new_token += char
Avoid deeply nested control flow statements. Open
if yang_flag[j] == 0 and _in_range(yang[j]):
if (ying[i], yang[j]) in adjwt:
n_simi += adjwt[(ying[i], yang[j])]
yang_flag[j] = 2
break
Avoid deeply nested control flow statements. Open
if backtrace:
trace_mat[i + 1, j + 1] = 2
if backtrace:
Avoid deeply nested control flow statements. Open
if mode == 1:
self._ordered_tokens.append(new_token)
new_token = char
else:
new_token += char
Avoid deeply nested control flow statements. Open
if (
abs(sp - tp) <= self._max_dist
and sp not in src_matched
and tp not in tar_matched
):
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function dist_abs
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def dist_abs(self, src: str, tar: str, normalized: bool = False) -> float:
"""Return the Minkowski distance (:math:`L^p`-norm) of two strings.
Parameters
----------
- 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 is_trans:
trans += 1
elif not ofs['trans']:
ofs['trans'] = True
trans += 1
Avoid deeply nested control flow statements. Open
while word in sentence_words:
sentence_words.remove(word)
for char in set(filter_chars):
Avoid deeply nested control flow statements. Open
while j < lt and k < ls and src[k] == tar[j]:
j += 1
k += 1
if k - i > best:
Avoid deeply nested control flow statements. Open
if mode == 1:
self._ordered_tokens.append(new_token)
new_token = char
else:
new_token += char
Function decode
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def decode(self, longval: int, nbits: int) -> str:
"""Decode the number to a string using the given statistics.
Parameters
----------
- 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 k - i > best:
best = k - i
start_src = i
end_src = k
start_tar = p
Avoid deeply nested control flow statements. Open
if mode == 2:
self._ordered_tokens.append(new_token)
new_token = char
else:
new_token += char
Consider simplifying this complex logical expression. Open
if i == 0 and word[0] == 'y':
word = 'Y' + word[1:]
elif word[i] == 'y' and word[i - 1] in self._vowels:
word = word[:i] + 'Y' + word[i + 1 :]
elif (
Consider simplifying this complex logical expression. Open
if (
len(word) >= 4
and word[-3] == word[-2]
and word[-2] in {'a', 'e', 'o', 'u'}
and word[-4] not in self._vowels
Consider simplifying this complex logical expression. Open
if (
word[1:2] in self._uc_c_set - {'M', 'N'}
and word[2:3] in self._uc_c_set
) or (
word[1:2] in self._uc_c_set and word[2:3] not in self._uc_c_set