piccolbo/Pweave

View on GitHub

Showing 86 of 86 total issues

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

                if lines[1].startswith("%"):
                    lines[1] = "<strong>Author:</strong> %s <BR/>" % (
                        lines[1].replace("%", "")
Severity: Major
Found in pweave/formatters/publish.py and 1 other location - About 1 hr to fix
pweave/formatters/publish.py on lines 114..116

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 46.

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

                if lines[2].startswith("%"):
                    lines[2] = "<strong>Date:</strong> %s <BR/>" % (
                        lines[2].replace("%", "")
Severity: Major
Found in pweave/formatters/publish.py and 1 other location - About 1 hr to fix
pweave/formatters/publish.py on lines 110..112

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 46.

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

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

        def count_emptylines(self, line):
            """Counts empty lines for parser, the result is stored in self.n_emptylines"""
            if line.strip() == "":
                self.n_emptylines += 1
            else:
    Severity: Major
    Found in pweave/readers.py and 1 other location - About 1 hr to fix
    pweave/readers.py on lines 194..199

    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 41.

    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 count_emptylines(self, line):
            """Counts empty lines for parser, the result is stored in self.n_emptylines"""
            if line.strip() == "":
                self.n_emptylines += 1
            else:
    Severity: Major
    Found in pweave/readers.py and 1 other location - About 1 hr to fix
    pweave/readers.py on lines 47..52

    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 41.

    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 __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

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

                        self.parsed.append(
                            {
                                "type": "doc",
                                "content": "\n" + "".join(cell["source"]),
                                "options": {},
        Severity: Major
        Found in pweave/readers.py and 1 other location - About 1 hr to fix
        pweave/readers.py on lines 352..357

        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 39.

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

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

                        self.parsed.append(
                            {
                                "type": "code",
                                "content": "\n" + "".join(cell["input"]),
                                "options": {},
        Severity: Major
        Found in pweave/readers.py and 1 other location - About 1 hr to fix
        pweave/readers.py on lines 362..367

        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 39.

        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 __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

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

                    if chunk["f_env"] is not None:
                        result += "\\begin{%s}\n" % chunk["f_env"]
            Severity: Minor
            Found in pweave/formatters/tex.py and 1 other location - About 45 mins to fix
            pweave/formatters/tex.py on lines 51..52

            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 35.

            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

                    if chunk["f_env"] is not None:
                        result += "\\end{%s}\n" % chunk["f_env"]
            Severity: Minor
            Found in pweave/formatters/tex.py and 1 other location - About 45 mins to fix
            pweave/formatters/tex.py on lines 30..31

            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 35.

            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