piccolbo/Pweave

View on GitHub

Showing 46 of 86 total issues

File bootstrap.py has 13507 lines of code (exceeds 250 allowed). Consider refactoring.
Open

css = u"""/*!
 * Bootstrap v3.3.6 (http://getbootstrap.com)
 * Copyright 2011-2015 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 */
Severity: Major
Found in pweave/themes/bootstrap.py - About 1 mo to fix

    File cerulean.py has 6906 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    css = u"""
    /*!
     * bootswatch v3.3.6
     * Homepage: http://bootswatch.com
     * Copyright 2012-2015 Thomas Park
    Severity: Major
    Found in pweave/themes/cerulean.py - About 2 wks to fix

      File journal.py has 6853 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      css = u"""
      @import url("https://fonts.googleapis.com/css?family=News+Cycle:400,700");
      /*!
       * bootswatch v3.3.6
       * Homepage: http://bootswatch.com
      Severity: Major
      Found in pweave/themes/journal.py - About 2 wks to fix

        File skeleton.py has 511 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # -*- coding: utf-8 -*-
        
        # Modified from skeleton from getskeleton.com
        # Smaller headers
        css = u"""
        Severity: Major
        Found in pweave/themes/skeleton.py - About 1 day to fix

          File readers.py has 484 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # Pweave readers
          import re
          import copy
          import json
          import io
          Severity: Minor
          Found in pweave/readers.py - About 7 hrs to fix

            Function run_cell has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
            Open

                def run_cell(self, src):
                    cell = {}
                    cell["source"] = src.lstrip()
                    msg_id = self.kc.execute(src.lstrip(), store_history=False)
            
            
            Severity: Minor
            Found in pweave/processors/jupyter.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

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

            PwebFormatter has 33 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class PwebFormatter(object):
                """Base class for all not-notebook formatters"""
            
                def __init__(
                    self,
            Severity: Minor
            Found in pweave/formatters/base.py - About 4 hrs to fix

              Function parse has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
              Open

                  def parse(self):
                      lines = self.rawtext.splitlines()
              
                      read = ""
                      chunks = []
              Severity: Minor
              Found in pweave/readers.py - About 4 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

              Function parse has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
              Open

                  def parse(self):
                      lines = self.rawtext.splitlines()
              
                      read = ""
                      chunks = []
              Severity: Minor
              Found in pweave/readers.py - About 3 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

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

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

              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
              Severity: Minor
              Found in pweave/formatters/base.py - About 2 hrs to fix

                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):
                Severity: Minor
                Found in pweave/processors/base.py - About 2 hrs to fix

                  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":
                  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 weave has 13 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

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

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

                        def formatfigure(self, chunk):
                            fignames = chunk["figure"]
                            caption = chunk["caption"]
                            width = chunk["width"]
                            label = chunk["name"]
                    Severity: Minor
                    Found in pweave/formatters/markdown.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 formatfigure has a Cognitive Complexity of 13 (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/markdown.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 9 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

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

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

                          def __init__(
                      Severity: Major
                      Found in pweave/formatters/jupyter_notebook.py - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language