piccolbo/Pweave

View on GitHub

Showing 46 of 86 total issues

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
Severity: Minor
Found in pweave/formatters/base.py - About 1 hr 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

Function __init__ has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(
Severity: Major
Found in pweave/pweb.py - About 1 hr to fix

    Function parsetitle has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def parsetitle(self, chunk):
            """Parse titleblock from first doc chunk, like Pandoc"""
            lines = chunk["content"].splitlines()
            if len(lines) > 3:
                if lines[0].startswith("%"):
    Severity: Minor
    Found in pweave/formatters/publish.py - About 55 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

    Function parsetitle has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def parsetitle(self, chunk):
            """Parse titleblock from first doc chunk, like Pandoc"""
            lines = chunk["content"].splitlines()
            if len(lines) > 3:
                if lines[0].startswith("%"):
    Severity: Minor
    Found in pweave/formatters/publish.py - About 55 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

    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
    Severity: Minor
    Found in pweave/processors/base.py - About 55 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

    Function __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(
    Severity: Major
    Found in pweave/processors/jupyter.py - About 50 mins to fix

      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
      Severity: Minor
      Found in pweave/processors/base.py - About 45 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

      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"]:
      Severity: Minor
      Found in pweave/formatters/base.py - About 45 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

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

          def __init__(self, parsed, kernel, source, docmode, figdir, outdir):
      Severity: Minor
      Found in pweave/processors/base.py - About 45 mins to fix

        Function convert has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def convert(
        Severity: Minor
        Found in pweave/__init__.py - About 35 mins to fix

          Function publish has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def publish(
          Severity: Minor
          Found in pweave/__init__.py - About 35 mins to fix

            Function formatfigure has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def formatfigure(self, chunk):
                    fignames = chunk["figure"]
                    caption = chunk["caption"]
                    width = chunk["width"]
                    result = ""
            Severity: Minor
            Found in pweave/formatters/tex.py - About 35 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

            Function convert has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def convert(self):
                    output = []
            
                    if self.outformat == "noweb":
                        code = "<<%s>>=%s\n@\n"
            Severity: Minor
            Found in pweave/readers.py - About 35 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

            Function formatfigure has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def formatfigure(self, chunk):
            
                    fignames = chunk["figure"]
            
                    if chunk["caption"]:
            Severity: Minor
            Found in pweave/formatters/markdown.py - About 35 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

            Avoid too many return statements within this function.
            Open

                            return ""
            Severity: Major
            Found in pweave/formatters/base.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return self.render_text(out["data"]["text/plain"], chunk)
              Severity: Major
              Found in pweave/formatters/base.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                                return chunks
                Severity: Major
                Found in pweave/processors/base.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                              return ""
                  Severity: Major
                  Found in pweave/formatters/base.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return chunk
                    Severity: Major
                    Found in pweave/processors/base.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              return "markdown"
                      Severity: Major
                      Found in pweave/formatters/__init__.py - About 30 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language