Showing 4,191 of 4,191 total issues
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(
Avoid deeply nested control flow statements. Open
Open
if backtrace:
trace_mat[i + 1, j + 1] = 2
Function sim_score
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def sim_score(self, src: str, tar: str) -> float:
"""Return the Morisita similarity 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
Open
if masked == 0:
feature_dict[feature] = '0' # 0
elif masked == mask:
feature_dict[feature] = '+/-' # +/-
elif masked & pos_mask:
Function decode
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def decode(self, text: str) -> str:
r"""Perform decoding of run-length-encoding (RLE).
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
Open
if mode == 2:
self._ordered_tokens.append(new_token)
new_token = char
else:
new_token += char
Avoid deeply nested control flow statements. Open
Open
if mode == 2:
self._ordered_tokens.append(new_token)
new_token = char
else:
new_token += char
Avoid deeply nested control flow statements. Open
Open
if backtrace:
trace_mat[i + 1, j + 1] = 2
if backtrace:
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(
Avoid deeply nested control flow statements. Open
Open
if mode == 1:
self._ordered_tokens.append(new_token)
new_token = char
else:
new_token += char
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(
Avoid deeply nested control flow statements. Open
Open
while word in sentence_words:
sentence_words.remove(word)
for char in set(filter_chars):
Consider simplifying this complex logical expression. Open
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
Open
if wlen > 4 and word[-3:] == 'ern':
word = word[:-3]
elif wlen > 3 and word[-2:] in {'em', 'en', 'er', 'es'}:
word = word[:-2]
elif wlen > 2 and (
Consider simplifying this complex logical expression. Open
Open
if (len(word) > 4 and word[-2:] in {'em', 'er'}) or (
len(word) > 5 and word[-2:] == 'nd'
):
word = word[:-2]
elif (word[-1] in {'e', 's', 'n'}) or (
Consider simplifying this complex logical expression. Open
Open
if skip:
skip -= 1
elif char in self._uc_vy_set:
code += char
# IIc
Consider simplifying this complex logical expression. Open
Open
if pos0 >= 0:
while (_phonet_rules[pos0] is None) or (
cast(str, _phonet_rules[pos0])[0] == char0
):
if pos0 > end3:
Consider simplifying this complex logical expression. Open
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
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
Consider simplifying this complex logical expression. Open
Open
if matches > 1 or (
matches == 1
and src1_num_words == 1
and tar1_num_words == 1
and (tar_len_specials > 0 or src_len_specials > 0)