Showing 5 of 5 total issues
Function convert_cell_output
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
Open
def convert_cell_output(
element=None,
doc: Doc | None = None,
) -> Div | None:
if (
- 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 input_format in choices:
elem = choices[input_format]
if input_format in RAW_TEX_FORMATS:
input_format += "+raw_tex"
return convert_text(elem.text, input_format=input_format, extra_args=PANNBPANDOCARGS)
Function setup_logging
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def setup_logging(
Consider simplifying this complex logical expression. Open
Open
if (
doc is not None
and (content := doc.content)
and isinstance(div := content[0], Div)
and len(div.content) == 1
Function prepare_jupytext_metadata
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def prepare_jupytext_metadata(
doc: Doc | None,
) -> None:
"""Replace doc metadata with jupytext metadata."""
if (
- 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"