lib/volt/server/html_parser/sandlebars_parser.rb

Summary

Maintainability
C
1 day
Test Coverage

Method parse has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def parse
      loop do
        if last && SPECIAL[last]
          # In a script or style tag, just look for the first end
          close_tag = "</#{last}>"
Severity: Minor
Found in lib/volt/server/html_parser/sandlebars_parser.rb - 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

Method start_tag has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def start_tag(tag, tag_name, rest, unary)
      section_tag = tag_name[0] == ':' && tag_name[1] =~ /[A-Z]/

      if section_tag
        tag_name = tag_name.underscore
Severity: Minor
Found in lib/volt/server/html_parser/sandlebars_parser.rb - 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

Method parse has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def parse
      loop do
        if last && SPECIAL[last]
          # In a script or style tag, just look for the first end
          close_tag = "</#{last}>"
Severity: Minor
Found in lib/volt/server/html_parser/sandlebars_parser.rb - About 1 hr to fix

    Method start_binding has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def start_binding
          binding    = ''
          open_count = 1
    
          # scan until we reach a {{ or }}
    Severity: Minor
    Found in lib/volt/server/html_parser/sandlebars_parser.rb - 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

    Method start_tag has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def start_tag(tag, tag_name, rest, unary)
          section_tag = tag_name[0] == ':' && tag_name[1] =~ /[A-Z]/
    
          if section_tag
            tag_name = tag_name.underscore
    Severity: Minor
    Found in lib/volt/server/html_parser/sandlebars_parser.rb - About 1 hr to fix

      Method end_tag has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def end_tag(tag, tag_name)
            # If no tag name is provided, close all the way up
            new_size = 0
      
            if tag
      Severity: Minor
      Found in lib/volt/server/html_parser/sandlebars_parser.rb - 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

      There are no issues that match your filters.

      Category
      Status