Showing 4,191 of 4,191 total issues
Avoid deeply nested control flow statements. Open
Open
if word[pos + 2 : pos + 3] in self._uc_vy_set:
code += 'C'
else: # CHR, CHL, etc.
code += 'K'
else:
Avoid deeply nested control flow statements. Open
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
Open
if (
(len(src) > (i + matches))
and src[i + matches].isalpha()
and (src[i + matches] in rule[1:])
):
Avoid deeply nested control flow statements. Open
Open
if _is_vowel(pos + 1):
meta_key += word[pos + 1]
pos += 2
else:
meta_key += 'H'
Function _expand_alternates
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
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
Open
for inst in installed: # pragma: no branch
if pack[0] == inst[0] and pack[2] <= inst[2]:
if not silent:
print( # pragma: no cover # noqa: T001
'{} package already up-to-date'.format(
Avoid deeply nested control flow statements. Open
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
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
Open
if phonetic[i] == ']':
i += 1
phonetic2 += phonetic[attrib_start:i]
break
i += 1
Avoid deeply nested control flow statements. Open
Open
if not search(right, phoneticx[i + pattern_length :]):
continue
# check that left context is satisfied
if lcontext != '':
Avoid deeply nested control flow statements. Open
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
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
Open
if (
(matches > 1)
and src[i + matches : i + matches + 1]
and (priority0 != ord('-'))
):
Function _sb_ends_in_short_syllable
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def _sb_ends_in_short_syllable(self, term: str) -> bool:
"""Return True iff term ends in a short syllable.
(...according to the Porter2 specification.)
- 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 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
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
Open
if not _is_vowel(pos + 1) and pos == 0:
meta_key += 'ES'
pos += 1
else:
meta_key += 'S'
Avoid deeply nested control flow statements. Open
Open
if _get_at(current + 2) == 'I':
primary, secondary = _metaph_add('J')
else:
primary, secondary = _metaph_add('K')
current += 2
Avoid deeply nested control flow statements. Open
Open
if _string_at(
(current + 3),
2,
{'OO', 'ER', 'EN', 'UY', 'ED', 'EM'},
):
Avoid deeply nested control flow statements. Open
Open
if start2 > 0:
pos = start2
start1 = start2
start2 = -1
end1 = end2