Showing 1,048 of 1,370 total issues
Avoid deeply nested control flow statements. Open
if 'meta' in base and i in base['meta']:
f[i] = Markup('<em>%s</em>') % f[i]
for i in range(len(t)):
Avoid deeply nested control flow statements. Open
for keyword in kwds:
self._mime_map[keyword] = mimetype
# augment/override mime_map from trac.ini
for mapping in self.config['mimeviewer'].getlist('mime_map'):
Function code_block_role
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def code_block_role(name, rawtext, text, lineno, inliner, options={},
content=[]):
if not hasattr(inliner, 'trac'):
return [], []
env, context = inliner.trac
- 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 add_meta
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_meta(req, content, http_equiv=None, name=None, scheme=None, lang=None):
Function run
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def run(self):
"""Begin processing data from the socket."""
self._keepGoing = True
while self._keepGoing:
try:
- 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 _get_list
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _get_list(self, sids):
all_anon = 'anonymous' in sids or '*' in sids
all_auth = 'authenticated' in sids or '*' in sids
sids = {self._split_sid(sid)
for sid in sids
- 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 web_context
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def web_context(req, resource=None, id=False, version=False, parent=False,
Function _send_csv
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _send_csv(self, req, cols, rows, sep=',', mimetype='text/plain',
Avoid deeply nested control flow statements. Open
if 0 <= idx < len(vals):
del vals[idx]
if not vals:
continue
else:
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, targets, time, author, comment, new_values, action):
Avoid deeply nested control flow statements. Open
for name in sel:
model.Version(self.env, name).delete()
if name == default:
self.config.set('ticket',
'default_version', '')
Avoid deeply nested control flow statements. Open
for name in sel:
model.Component(self.env, name).delete()
if name == default:
self.config.set('ticket',
'default_component', '')
Avoid deeply nested control flow statements. Open
if href is not None:
result['href'] = href.ticket(val)
elif name in self.time_fields:
Avoid deeply nested control flow statements. Open
if newv:
change_data[field] = {'oldvalue': old,
'newvalue': new}
Function execute_paginated_report
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def execute_paginated_report(self, req, id, sql, args, limit=0, offset=0):
Avoid deeply nested control flow statements. Open
if a == b:
ids.append(str(a))
else:
id_clauses.append('t.id BETWEEN %s AND %s')
args.append(a)
Avoid deeply nested control flow statements. Open
if prev_t == t:
ticket = ev[3][0]
batch_ev[3][0].append(ticket.id)
else:
yield batch_ev
Function milestone_stats_data
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def milestone_stats_data(env, req, stat, name, grouped_by='component',
Function _query_link
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _query_link(self, req, name, value, text=None, class_=None, query=None):
Avoid deeply nested control flow statements. Open
for name in sel:
milestone = model.Milestone(self.env, name)
milestone.move_tickets(None, req.authname,
"Milestone deleted")
milestone.delete()