Showing 1,372 of 1,372 total issues
Function __init__
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, env, tkt_id=None, version=None):
self.env = env
self.fields = TicketSystem(self.env).get_ticket_fields()
self.editable_fields = \
{f['name'] for f in self.fields
- 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 __init__
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, req, options):
environ = {}
environ.update(apache.build_cgi_env(req))
environ['trac.web.frontend'] = 'mod_python'
- 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
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 _send_headers
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _send_headers(self):
assert self.headers_set, 'Response not started'
if not self.headers_sent:
status, headers = self.headers_sent = self.headers_set
- 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 len(f) == 0:
b['type'] = 'add'
elif len(t) == 0:
b['type'] = 'rem'
elif len(f) == len(t):
Avoid deeply nested control flow statements. Open
if side == 'base':
fromline += 1
else:
toline += 1
block[side]['lines'].append(line)
Avoid deeply nested control flow statements. Open
if old_db_val is None:
field = self.fields.by_name(name)
default = self._custom_field_default(field)
if self.values.get(name) == default:
continue
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 load
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def load(self, filename):
"""Load account information from apache style htdigest files,
only users from the specified realm are used
"""
# FIXME use a logger
- 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 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 arg_list_to_args
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def arg_list_to_args(arg_list):
"""Convert a list of `(name, value)` tuples into into a `_RequestArgs`."""
args = _RequestArgs()
for name, value in arg_list:
if name in args:
- 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 do_auth
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def do_auth(self, environ, start_response):
header = environ.get('HTTP_AUTHORIZATION')
if not header or not header.startswith('Digest'):
self.send_auth_request(environ, start_response)
return None
- 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 _redirect_back
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _redirect_back(self, req):
"""Redirect the user back to the URL she came from."""
referer = self._referer(req)
if referer:
if not referer.startswith(('http://', 'https://')):
- 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 _types
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _types(self):
types = {}
for lexer_name, aliases, _, mimetypes in get_all_lexers():
name = aliases[0] if aliases else lexer_name
for mimetype in mimetypes:
- 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 __setitem__
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def __setitem__(self, name, value):
"""Log ticket modifications so the table ticket_change can be updated
"""
if value and name not in self.time_fields:
if isinstance(value, list):
- 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 href is not None:
result['href'] = href.ticket(val)
elif name in self.time_fields:
Avoid deeply nested control flow statements. Open
if user:
vals[i] = val.replace('$USER', user)
elif val.endswith('$USER'):
del clause[field]
break
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
if newv:
change_data[field] = {'oldvalue': old,
'newvalue': new}
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, '')