Showing 9,525 of 13,510 total issues
Avoid deeply nested control flow statements. Open
Open
if node in match_set[fixer]:
match_set[fixer].remove(node)
Function show
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def show(caps):
print "Mailcap files:"
for fn in listmailcapfiles(): print "\t" + fn
print
if not caps: caps = getcaps()
- 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
Open
if token[-1] == '\n': # continued string
strstart = (lnum, start)
endprog = (endprogs[initial] or endprogs[token[1]] or
endprogs[token[2]])
contstr, needcont = line[start:], 1
Avoid deeply nested control flow statements. Open
Open
if child.children[2].value == name:
return node
elif child.type == token.NAME and child.value == name:
Avoid deeply nested control flow statements. Open
Open
if endmatch: # all on one line
pos = endmatch.end(0)
token = line[start:pos]
yield (STRING, token, spos, (lnum, pos), line)
else:
Function _interpolate_some
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def _interpolate_some(self, option, accum, rest, section, map, depth):
Avoid deeply nested control flow statements. Open
Open
if not e:
e = ParsingError(fpname)
e.append(lineno, repr(line))
Avoid deeply nested control flow statements. Open
Open
if node.fixers_applied and fixer in node.fixers_applied:
# do not apply the same fixer again
continue
Avoid deeply nested control flow statements. Open
Open
if endmatch: # all on one line
pos = endmatch.end(0)
token = line[start:pos]
yield (STRING, token, spos, (lnum, pos), line)
else:
Avoid deeply nested control flow statements. Open
Open
if not self.stack:
# Done parsing!
return True
dfa, state, node = self.stack[-1]
Avoid deeply nested control flow statements. Open
Open
for state in dfa:
state.unifystate(state_j, state_i)
changes = True
Avoid deeply nested control flow statements. Open
Open
Avoid deeply nested control flow statements. Open
Open
if initial in '([{':
parenlev += 1
elif initial in ')]}':
parenlev -= 1
yield (OP, token, spos, epos, line)
Function refactor
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def refactor(self, items, write=False, doctests_only=False,
num_processes=1):
if num_processes == 1:
return super(MultiprocessRefactoringTool, self).refactor(
items, write, doctests_only)
- 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
Open
if token[-1] == '\n': # continued string
strstart = (lnum, start)
endprog = (endprogs[initial] or endprogs[token[1]] or
endprogs[token[2]])
contstr, needcont = line[start:], 1
Avoid deeply nested control flow statements. Open
Open
if initial in '([{': parenlev = parenlev + 1
elif initial in ')]}': parenlev = parenlev - 1
yield (OP, token, spos, epos, line)
Avoid deeply nested control flow statements. Open
Open
if kid.type == token.COLON and kid.value == ":":
# i+3 is the colon, i+4 is the suite
n = find_binding(name, make_suite(child.children[i+4]), package)
if n: ret = n
elif child.type in _def_syms and child.children[1].value == name:
Avoid deeply nested control flow statements. Open
Open
if results:
new = fixer.transform(node, results)
if new is not None:
node.replace(new)
#new.fixers_applied.append(fixer)
Avoid deeply nested control flow statements. Open
Open
for line in diff_lines:
print line
sys.stdout.flush()
Avoid deeply nested control flow statements. Open
Open
if parenlev > 0:
newline = NL
yield (newline, token, spos, epos, line)