piccolbo/Pweave

View on GitHub

Showing 86 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

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

        Severity: Major
        Found in doc/examples/FIR_design.py and 1 other location - About 4 days to fix
        doc/examples/FIR_design_cells.py on lines 0..127

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 466.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

        Severity: Major
        Found in doc/examples/FIR_design_cells.py and 1 other location - About 4 days to fix
        doc/examples/FIR_design.py on lines 0..128

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 466.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            def format_docchunk(self, chunk):
                if "number" in chunk and chunk["number"] == 1:
                    chunk = self.parsetitle(chunk)
                try:
                    pandoc = Popen(
        Severity: Major
        Found in pweave/formatters/publish.py and 1 other location - About 1 day to fix
        pweave/formatters/publish.py on lines 172..187

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 144.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        class PwebPandocMDtoHTMLFormatter(PwebMDtoHTMLFormatter):
            def format_docchunk(self, chunk):
                if "number" in chunk and chunk["number"] == 1:
                    chunk = self.parsetitle(chunk)
                try:
        Severity: Major
        Found in pweave/formatters/publish.py and 1 other location - About 1 day to fix
        pweave/formatters/publish.py on lines 271..285

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 144.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        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

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

                def formatfigure(self, chunk):
                    fignames = chunk["figure"]
                    caption = chunk["caption"]
                    width = chunk["width"]
                    result = ""
            Severity: Major
            Found in pweave/formatters/rst.py and 1 other location - About 7 hrs to fix
            pweave/formatters/rst.py on lines 79..97

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 116.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

                def formatfigure(self, chunk):
                    fignames = chunk["figure"]
                    caption = chunk["caption"]
                    width = chunk["width"]
                    result = ""
            Severity: Major
            Found in pweave/formatters/rst.py and 1 other location - About 7 hrs to fix
            pweave/formatters/rst.py on lines 25..43

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 116.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

                @classmethod
                def shortformats(cls):
                    fmtstring = ""
                    names = list(cls.formats.keys())
                    n = len(names)
            Severity: Major
            Found in pweave/readers.py and 1 other location - About 5 hrs to fix
            pweave/formatters/__init__.py on lines 98..108

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 92.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

                @classmethod
                def shortformats(cls):
                    fmtstring = ""
                    names = list(cls.formats.keys())
                    n = len(names)
            Severity: Major
            Found in pweave/formatters/__init__.py and 1 other location - About 5 hrs to fix
            pweave/readers.py on lines 409..419

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 92.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            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

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                      if chunk["caption"]:
                          # Write labels as data-attribute for javascript etc.
                          if chunk["name"]:
                              labelstring = 'data-label = "fig:%s"' % chunk["name"]
                          else:
              Severity: Major
              Found in pweave/formatters/publish.py and 1 other location - About 4 hrs to fix
              pweave/formatters/publish.py on lines 153..168

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 74.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                      if chunk["caption"]:
                          # Write labels as data-attribute for javascript etc.
                          if chunk["name"]:
                              labelstring = 'data-label = "fig:%s"' % chunk["name"]
                          else:
              Severity: Major
              Found in pweave/formatters/publish.py and 1 other location - About 4 hrs to fix
              pweave/formatters/publish.py on lines 55..70

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 74.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                      if optstring.split(",")[0].find("=") == -1:
                          splitted = optstring.split(",")
                          splitted[0] = 'name = "%s"' % splitted[0]
                          optstring = ",".join(splitted)
              Severity: Major
              Found in pweave/readers.py and 1 other location - About 3 hrs to fix
              pweave/readers.py on lines 320..323

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 73.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Severity
              Category
              Status
              Source
              Language