PwebFormatter
has 33 functions (exceeds 20 allowed). Consider refactoring. Open
class PwebFormatter(object):
"""Base class for all not-notebook formatters"""
def __init__(
self,
Function format
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def format(self):
self.formatted = []
for chunk in self.executed:
# Fill in options for code chunks
if chunk["type"] == "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 format_codechunks
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def format_codechunks(self, chunk):
chunk["content"] = self._indent(chunk["content"])
# Code is not executed
if not chunk["evaluate"]:
- 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
File base.py
has 262 lines of code (exceeds 250 allowed). Consider refactoring. Open
import textwrap
import os
import base64
import copy
from nbconvert import filters
Function render_jupyter_output
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def render_jupyter_output(self, out, chunk):
if out["output_type"] == "error":
return self.render_traceback("".join(out["traceback"]), chunk)
if out["output_type"] == "stream":
- 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 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function format_text_result
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def format_text_result(self, text, chunk):
chunk["result"] = text
result = ""
if "%s" in chunk["outputstart"]:
chunk["outputstart"] = chunk["outputstart"] % self.language
- 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 figures_from_chunk
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def figures_from_chunk(self, chunk):
"""Extract base64 encoded figures from chunk"""
figs = []
i = 1
for out in chunk["result"]:
- 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 too many return
statements within this function. Open
return ""
Avoid too many return
statements within this function. Open
return self.render_text(out["data"]["text/plain"], chunk)
Avoid too many return
statements within this function. Open
return ""