jungomi/mdn_query

View on GitHub

Showing 4 of 11 total issues

Method traverse has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    def traverse
      unless @dom.css('div.nonStandard').empty?
        @current_section.append_text("\n> ***Non-standard***\n")
      end
      blacklist_level = nil
Severity: Minor
Found in lib/mdn_query/traverse_dom.rb - 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

Method traverse has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def traverse
      unless @dom.css('div.nonStandard').empty?
        @current_section.append_text("\n> ***Non-standard***\n")
      end
      blacklist_level = nil
Severity: Minor
Found in lib/mdn_query/traverse_dom.rb - About 1 hr to fix

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

        def max_col_sizes
          max_sizes = @heading.map { |col| col.size > 3 ? col.size : 3 }
          @body.each do |row|
            row.each.with_index do |str, index|
              next unless str.size > max_sizes[index]
    Severity: Minor
    Found in lib/mdn_query/table.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

    Method url has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def url
          query_url = "#{@url}?q=#{@query}&locale=#{@locale}"
          query_url << @topics.map { |t| "&topic=#{t}" }.join
          unless @css_classnames.nil?
            query_url << "&css_classnames=#{@css_classnames}"
    Severity: Minor
    Found in lib/mdn_query/search.rb - About 25 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

    Severity
    Category
    Status
    Source
    Language