sarnold/pystache

View on GitHub

Showing 14 of 27 total issues

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

    def parse(self, template):
        """
        Parse a template string starting at some index.

        This method uses the current tag delimiter.
Severity: Minor
Found in pystache/parser.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

File renderer.py has 331 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# coding: utf-8

"""
This module provides a Renderer class to render templates.

Severity: Minor
Found in pystache/renderer.py - About 3 hrs to fix

    Renderer has 21 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Renderer(object):
    
        """
        A class for rendering mustache templates.
    
    
    Severity: Minor
    Found in pystache/renderer.py - About 2 hrs to fix

      File parser.py has 252 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # coding: utf-8
      
      """
      Exposes a parse() function to parse template strings.
      
      
      Severity: Minor
      Found in pystache/parser.py - About 2 hrs to fix

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

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

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

          def _get_value(context, key):
              """
              Retrieve a key's value from a context item.
          
              Returns _NOT_FOUND if the key does not exist.
          Severity: Minor
          Found in pystache/context.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 a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def __init__(
                  self,
                  file_encoding=None,
                  string_encoding=None,
                  decode_errors=None,
          Severity: Minor
          Found in pystache/renderer.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, key, parsed, delimiters, template, index_begin, index_end):
          Severity: Minor
          Found in pystache/parser.py - About 45 mins to fix

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

                def _make_section_node(
            Severity: Minor
            Found in pystache/parser.py - About 45 mins to fix

              Function fetch_section_data has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def fetch_section_data(self, context, name):
                      """
                      Fetch the value of a section as a list.
              
                      """
              Severity: Minor
              Found in pystache/renderengine.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 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

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

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

                    def create(*context, **kwargs):
                        """
                        Build a ContextStack instance from a sequence of context-like items.
                
                        This factory-style method is more general than the ContextStack class's
                Severity: Minor
                Found in pystache/context.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 get has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def get(self, name):
                        """
                        Resolve a dotted name against the current context stack.
                
                        This function follows the rules outlined in the section of the
                Severity: Minor
                Found in pystache/context.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 _PartialNode(tag_key, leading_whitespace)
                Severity: Major
                Found in pystache/parser.py - About 30 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language