bhollis/maruku

View on GitHub
lib/maruku/input/html_helper.rb

Summary

Maintainability
D
1 day
Test Coverage

Method eat_this has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

    def eat_this(line)
      @rest = line + @rest
      things_read = 0
      until @rest.empty?
        case self.state
Severity: Minor
Found in lib/maruku/input/html_helper.rb - 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

Method eat_this has 79 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def eat_this(line)
      @rest = line + @rest
      things_read = 0
      until @rest.empty?
        case self.state
Severity: Major
Found in lib/maruku/input/html_helper.rb - About 3 hrs to fix

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

        def handle_tag
          @already << @m.pre_match
          @rest = @m.post_match
    
          is_closing = !!@m[1]
    Severity: Minor
    Found in lib/maruku/input/html_helper.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 handle_tag has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def handle_tag
          @already << @m.pre_match
          @rest = @m.post_match
    
          is_closing = !!@m[1]
    Severity: Minor
    Found in lib/maruku/input/html_helper.rb - About 1 hr to fix

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

          def close_script_style
            tag = @tag_stack.last
      
            # See http://www.w3.org/TR/xhtml1/#C_4 for character sequences not allowed within an element body.
            if @already =~ /<|&|\]\]>|--/
      Severity: Minor
      Found in lib/maruku/input/html_helper.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