Showing 383 of 4,191 total issues
Avoid deeply nested control flow statements. Open
if current > 0:
if _string_at(0, 2, {'MC'}):
# e.g., "McHugh"
primary, secondary = _metaph_add('K')
else:
Avoid deeply nested control flow statements. Open
if k > 0:
# add hash value for this letter
if phonet_hash_1[j, k] < 0:
phonet_hash_1[j, k] = i
phonet_hash_2[j, k] = i
Avoid deeply nested control flow statements. Open
if k <= 0:
# add hash value for all letters
if phonet_hash_1[j, 0] < 0:
phonet_hash_1[j, 0] = i
Avoid deeply nested control flow statements. Open
if pos0 >= 0:
while (_phonet_rules[pos0] is None) or (
cast(str, _phonet_rules[pos0])[0] == char0
):
if pos0 > end3:
Avoid deeply nested control flow statements. Open
if (priority0 == 1) and (zeta == 0):
# rule with '<' is applied
if (
(j > 0)
and rule
Avoid deeply nested control flow statements. Open
if phonetic[i] == ']':
i += 1
phonetic2 += phonetic[attrib_start:i]
break
i += 1
Avoid deeply nested control flow statements. Open
if word[pos + 1 : pos + 2] == 'C':
meta_key += 'X'
pos += 2
# special case 'cesar', 'cien', 'cid', 'conciencia'
elif word[pos + 1 : pos + 2] in {'E', 'I'}:
Avoid deeply nested control flow statements. Open
if os.path.isdir(os.path.join(check_path, package)):
with open(
os.path.join(check_path, package + '.xml')
) as xml:
file = xml.read()
Avoid deeply nested control flow statements. Open
if (
(current == 1) and _get_at(current - 1) == 'A'
) or _string_at((current - 1), 5, {'UCCEE', 'UCCES'}):
primary, secondary = _metaph_add('KS')
# 'bacci', 'bertucci', other italian
Function _language
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _language(self, name: str, name_mode: str) -> int:
"""Return the best guess language ID for the word and language choices.
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 not search(right, phoneticx[i + pattern_length :]):
continue
# check that left context is satisfied
if lcontext != '':
Function _expand_alternates
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _expand_alternates(self, phonetic: str) -> str:
r"""Expand phonetic alternates separated by \|s.
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 _phonet_rules[pos] and (
'<' in cast(str, _phonet_rules[pos])[1:]
):
priority0 = 1
else:
Avoid deeply nested control flow statements. Open
if word[pos + 1 : pos + 2] in {'E', 'I'}:
meta_key += 'J'
pos += 2
# base case
else:
Avoid deeply nested control flow statements. Open
if word[pos + 1 : pos + 2] == 'U':
pos += 2
else:
pos += 1
meta_key += 'K'
Function sim
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def sim(self, src: str, tar: str) -> float:
"""Return the Horn-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
if is_trans:
trans += self._transposition_cost_evaluator(
src_cur, tar_cur
)
elif not ofs['trans']:
Function fingerprint_int
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def fingerprint_int(self, word: str) -> int:
"""Return the LACSS coding.
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 (
abs(sp - tp) <= self._max_dist
and sp not in src_matched
and tp not in tar_matched
):
Function fingerprint
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def fingerprint(self, word: str) -> str:
"""Return the extract - position & frequency coding.
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"