lib/volt/server/html_parser/attribute_scope.rb

Summary

Maintainability
A
3 hrs
Test Coverage

Method getter_to_setter has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def getter_to_setter(getter)
      getter = getter.strip.gsub(/\(\s*\)/, '')

      # Check to see if this can be converted to a setter
      if getter[0] =~ /^[A-Z]/ && getter[-1] != ')'
Severity: Minor
Found in lib/volt/server/html_parser/attribute_scope.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 process_attribute has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def process_attribute(tag_name, attributes, attribute_name, value)
      parts, binding_count = binding_parts_and_count(value)

      # if this attribute has bindings
      if binding_count > 0
Severity: Minor
Found in lib/volt/server/html_parser/attribute_scope.rb - 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

Method add_multiple_attribute has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def add_multiple_attribute(tag_name, id, attribute_name, parts, content)
Severity: Minor
Found in lib/volt/server/html_parser/attribute_scope.rb - About 35 mins to fix

    Method add_multiple_attribute has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def add_multiple_attribute(tag_name, id, attribute_name, parts, content)
          case attribute_name
            when 'checked', 'value'
              if parts.size > 1
                if tag_name == 'textarea'
    Severity: Minor
    Found in lib/volt/server/html_parser/attribute_scope.rb - 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

    There are no issues that match your filters.

    Category
    Status