Showing 1,048 of 1,370 total issues
Avoid deeply nested control flow statements. Open
if prev:
prev = 'equal', prev[1], i2, prev[3], j2
else:
prev = 'equal', i1, i2, j1, j2
continue
Avoid deeply nested control flow statements. Open
for line in fromlines[i1:i2]:
line = expandtabs(line, tabwidth, '\0\1')
line = escape(line, quotes=False)
line = '<del>'.join(space_re.sub(htmlify, seg)
for seg in line.split('\0'))
Avoid deeply nested control flow statements. Open
if name and name != path_info and 'alias' not in info:
cset_added = tag.code('trac-admin "%s" changeset '
'added "%s" $REV'
% (self.env.path,
pretty_name))
Function render_property_diff
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def render_property_diff(self, name, old_context, old_props,
Avoid deeply nested control flow statements. Open
if parent != parents[0]:
thread.append([0, col, line])
add_edge(thread, next_revs.index(parent), line + 1)
Avoid deeply nested control flow statements. Open
if ($('em', cells[1]).length) oldTag = "\\";
Avoid deeply nested control flow statements. Open
if not all_equal():
yield group
group = []
Avoid deeply nested control flow statements. Open
if 'id' not in info:
info['id'] = self.get_repository_id(reponame)
all_repositories[reponame] = info
Avoid deeply nested control flow statements. Open
if (value is not None
or field in ('hidden', 'sync_per_request')) \
and value != info.get(field):
changes[field] = value
if 'dir' in changes and not \
Function annotate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def annotate(self, row, lineno):
if lineno > len(self.annotations):
row.append(tag.th())
return
rev = self.annotations[lineno-1]
- 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_path_links
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_path_links(href, reponame, path, rev, order=None, desc=None):
Function truncate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def truncate(self, curr_pair, new_pair=None):
curr_pair = tuple(curr_pair)
if new_pair:
new_pair = tuple(new_pair)
revranges = RevRanges(self.repos, resolve=self.resolve)
- 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 _render_zip
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _render_zip(self, req, context, repos, root_node, rev=None):
Function _render_file
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _render_file(self, req, context, repos, node, rev=None):
Avoid deeply nested control flow statements. Open
with content_closing(
node.get_processed_content(eol_hint='CRLF')) \
as content:
data = content.read()
props = node.get_properties()
Function load_pages
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def load_pages(self, dir, ignore=[], create_only=[], replace=False):
loaded = []
with self.env.db_transaction:
for page in sorted(os.listdir(dir)):
if page in ignore:
- 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_timeline_events
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_timeline_events(self, req, start, stop, filters):
if 'wiki' in filters:
wiki_realm = Resource(self.realm)
for ts, name, comment, author, version in self.env.db_query("""
SELECT time, name, comment, author, version FROM wiki
- 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 arg == 'inline':
inline = True
elif arg == 'unnumbered':
numbered = False
Function rename
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def rename(self, new_name):
"""Rename wiki page in-place, keeping the history intact.
Renaming a page this way will eventually leave dangling references
to the old page - which literally doesn't exist anymore.
"""
- 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 _macro_formatter
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _macro_formatter(self, match, fullmatch, macro, only_inline=False):
name = fullmatch.group('macroname')
if name and name[-1] == '?': # Macro?() shortcut for MacroList(Macro)
args = name[:-1] or '*'
else:
- 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"