Showing 1,050 of 1,372 total issues
Avoid deeply nested control flow statements. Open
if v < version:
if not prev_version:
prev_version = v
break
else:
Function export_page
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def export_page(self, page, filename):
wikipage = model.WikiPage(self.env, page)
if wikipage.exists:
if not filename:
printout(wikipage.text)
- 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 _prepare_diff
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _prepare_diff(self, req, page, old_text, new_text,
Avoid deeply nested control flow statements. Open
if repos.has_node(path, next_rev):
next_href = req.href.changeset(next_rev, reponame,
path)
else: # must be 'D'elete or 'R'ename, show full cset
next_href = req.href.changeset(next_rev, reponame)
Avoid deeply nested control flow statements. Open
if len(flag) > 1:
keys.append(str(flag[1:]))
values.append(False)
else:
Function _make_lhref_link
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _make_lhref_link(self, match, fullmatch, rel, ns, target, label):
Function daemonize
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def daemonize(pidfile=None, progname=None, stdin='/dev/null',
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, safe_schemes=SAFE_SCHEMES, safe_css=SAFE_CSS,
Function appendrange
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def appendrange(self, r):
"""Add ranges to the current one.
A range is specified as a string of the form "low-high", and
`r` can be a list of such strings, a string containing comma-separated
- 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 action not in req.perm:
add_warning(req,
_("The permission %(action)s was "
"not granted to %(subject)s "
"because users cannot grant "
Avoid deeply nested control flow statements. Open
if l.territory:
locale = l
break
except (UnknownLocaleError, ValueError):
Avoid deeply nested control flow statements. Open
if kwarg_name in func_kwargs_map:
messages_kwargs[kwarg_name] = message
else:
messages.append(message)
del buf[:]
Function wrap
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def wrap(t, cols=75, initial_indent='', subsequent_indent='',
Avoid deeply nested control flow statements. Open
if kwarg_name in func_kwargs_map:
messages_kwargs[kwarg_name] = message
else:
messages.append(message)
del buf[:]
Function create_zipinfo
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_zipinfo(filename, mtime=None, dir=False, executable=False, symlink=False,
Function add
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def add(cls, env, sid, authenticated, class_, realm, targets):
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, cols, replace_whitespace=0, break_long_words=0,
Function _download_as_zip
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _download_as_zip(self, req, parent, attachments=None):
if attachments is None:
attachments = self.viewable_attachments(web_context(req, parent))
total_size = sum(attachment.size for attachment in attachments)
if total_size > self.max_zip_size:
- 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 escape
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def escape(text, quotes=True):
"""Create a Markup instance from a string and escape special characters
it may contain (<, >, & and \").
:param text: the string to escape; if not a string, it is assumed that
- 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 __call__
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def __call__(self, *args, **kwargs):
if kwargs:
d = self._dict_from_kwargs(kwargs)
if d:
if self.attrib:
- 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"