Showing 5 of 5 total issues

Function convert_cell_output has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

def convert_cell_output(
    element=None,
    doc: Doc | None = None,
) -> Div | None:
    if (
Severity: Minor
Found in src/pannb/__init__.py - About 5 hrs to fix

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 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)
Severity: Major
Found in src/pannb/__init__.py - About 45 mins to fix

    Function setup_logging has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def setup_logging(
    Severity: Minor
    Found in src/pannb/util.py - About 45 mins to fix

      Consider simplifying this complex logical expression.
      Open

          if (
              doc is not None
              and (content := doc.content)
              and isinstance(div := content[0], Div)
              and len(div.content) == 1
      Severity: Major
      Found in src/pannb/__init__.py - About 40 mins to fix

        Function prepare_jupytext_metadata has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def prepare_jupytext_metadata(
            doc: Doc | None,
        ) -> None:
            """Replace doc metadata with jupytext metadata."""
            if (
        Severity: Minor
        Found in src/pannb/__init__.py - About 25 mins to fix

        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

        Severity
        Category
        Status
        Source
        Language