bhollis/maruku

View on GitHub
lib/maruku/html.rb

Summary

Maintainability
C
1 day
Test Coverage

Method process_markdown_inside_elements has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    def process_markdown_inside_elements(doc)
      # find span elements or elements with 'markdown' attribute
      elts = @fragment.css("[markdown]")

      d = @fragment.children.first
Severity: Minor
Found in lib/maruku/html.rb - About 3 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 process_markdown_inside_elements has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    def process_markdown_inside_elements(doc)
      elts = []
      @fragment.each_element('//*[@markdown]') do |e|
        elts << e
      end
Severity: Minor
Found in lib/maruku/html.rb - About 3 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 process_markdown_inside_elements has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def process_markdown_inside_elements(doc)
      elts = []
      @fragment.each_element('//*[@markdown]') do |e|
        elts << e
      end
Severity: Minor
Found in lib/maruku/html.rb - About 1 hr to fix

    Method process_markdown_inside_elements has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def process_markdown_inside_elements(doc)
          # find span elements or elements with 'markdown' attribute
          elts = @fragment.css("[markdown]")
    
          d = @fragment.children.first
    Severity: Minor
    Found in lib/maruku/html.rb - About 1 hr to fix

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

          def span_descendents(e)
            descendents = []
            e.each_element do |c|
              name = c.respond_to?(:name) ? c.name : nil
              if name && HTML_INLINE_ELEMS.include?(c.name)
      Severity: Minor
      Found in lib/maruku/html.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