Function _runcode
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def _runcode(self, chunk):
"""Execute code from a code chunk based on options"""
if chunk["type"] != "doc" and chunk["type"] != "code":
return chunk
- 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
PwebProcessorBase
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class PwebProcessorBase(object):
"""Processors run code from parsed Pweave documents. This is an abstract base
class for specific implementations"""
def __init__(self, parsed, kernel, source, docmode, figdir, outdir):
Function run
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def run(self):
# Create directory for figures
self.ensureDirectoryExists(self.getFigDirectory())
# Documentation mode uses results from previous executions
# so that compilation is fast if you only work on doc chunks
- 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 loadinline
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def loadinline(self, content):
"""Evaluate code from doc chunks using ERB markup"""
# Flags don't work with ironpython
splitted = re.split("(<%[\w\s\W]*?%>)", content) # , flags = re.S)
# No inline code
- 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 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, parsed, kernel, source, docmode, figdir, outdir):
Avoid too many return
statements within this function. Open
return chunks
Avoid too many return
statements within this function. Open
return chunk
Function _getoldresults
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _getoldresults(self):
"""Get the results of previous run for documentation mode"""
success = self.restore()
if not success:
- 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"