Showing 1,048 of 1,370 total issues
Avoid deeply nested control flow statements. Open
for name in sel:
self._enum_cls(self.env, name).delete()
if name == default:
self.config.set('ticket',
'default_%s' % self._type, '')
Function _render_property_diff
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _render_property_diff(self, req, ticket, field, old, new,
Avoid deeply nested control flow statements. Open
for enum in self._enum_cls.select(self.env):
new_value = order[enum.value]
if new_value != enum.value:
enum.value = new_value
enum.update()
Avoid deeply nested control flow statements. Open
with self.env.db_query as db:
for name, value in db(
"SELECT name, %s FROM enum WHERE type=%%s"
% db.cast('value', 'int'),
(sort_col,)):
Avoid deeply nested control flow statements. Open
if not word:
continue
clauses.append("COALESCE(%s,'') %s%s" % (col, cneg,
Avoid deeply nested control flow statements. Open
if user:
vals[i] = val.replace('$USER', user)
elif val.endswith('$USER'):
del clause[field]
break
Avoid deeply nested control flow statements. Open
if field == 'description':
new_descr = wrap(new, self.COLS, ' ', ' ', '\n',
self.ambiwidth)
old_descr = wrap(old, self.COLS, '> ', '> ', '\n',
self.ambiwidth)
Function get_available_actions
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_available_actions(self, req, ticket):
"""Returns a sorted list of available actions"""
# The list should not have duplicates.
actions = {}
for controller in self.action_controllers:
- 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 cnum == 'description':
title = _("Description for #%(id)s: %(summary)s",
id=resource.id, summary=summary)
else:
title = _("Comment %(cnum)s for #%(id)s: "
Avoid deeply nested control flow statements. Open
if ends:
vals = [start + '..' + end
for (start, end) in zip(vals, ends)]
if k in remove_constraints:
Function next_rev
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def next_rev(self, rev, path='', find_initial_rev=False):
"""Return revision immediately following `rev`, eventually below
given `path` or globally.
"""
rev = self.normalize_rev(rev)
- 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
Function blame
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def blame(self, commit_sha, path):
in_metadata = False
commit_sha = _rev_b(commit_sha)
path = self._fs_from_unicode(path)
- 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 data:
break
m.update(data)
Avoid deeply nested control flow statements. Open
if not group['fields']:
continue
yield group
Avoid deeply nested control flow statements. Open
for prev_id, in db(
"SELECT max(id) FROM ticket WHERE id < %s",
(ticket.id,)):
add_ticket_link('prev', int(prev_id))
if ticket.id < max_id:
Function __init__
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, path, params, log):
self.log = log
self.pool = Pool()
# note that this should usually not happen (str arg expected)
- 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 ev:
yield ev
# Attachments
if 'ticket_details' in filters:
Avoid deeply nested control flow statements. Open
if older[0] == path:
# still on the path: 'newer' was an edit
yield newer[0], newer[1], Changeset.EDIT
else:
# the path changed: 'newer' was a copy
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, git_dir, log, git_bin='git', git_fs_encoding=None,
Avoid deeply nested control flow statements. Open
if top and top.expr != s.expr:
warn.append(("'endblock %s' misplaced or misspelled,"
" current block is '%s %s'") %
(s.expr, top.kw, top.expr))
else: