lib/rdoc/markup/attribute_manager.rb

Summary

Maintainability
C
7 hrs
Test Coverage

Method split_into_flow has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

  def split_into_flow
    res = []
    current_attr = 0

    str_len = @str.length
Severity: Minor
Found in lib/rdoc/markup/attribute_manager.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 convert_attrs_word_pair_map has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

  def convert_attrs_word_pair_map(str, attrs, exclusive)
    # then non-matching
    unless @word_pair_map.empty? then
      @word_pair_map.each do |regexp, attr|
        next unless exclusive == exclusive?(attr)
Severity: Minor
Found in lib/rdoc/markup/attribute_manager.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 split_into_flow has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def split_into_flow
    res = []
    current_attr = 0

    str_len = @str.length
Severity: Minor
Found in lib/rdoc/markup/attribute_manager.rb - About 1 hr to fix

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

      def display_attributes
        puts
        puts @str.tr(NULL, "!")
        bit = 1
        16.times do |bno|
    Severity: Minor
    Found in lib/rdoc/markup/attribute_manager.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 convert_regexp_handlings has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def convert_regexp_handlings str, attrs, exclusive = false
        @regexp_handlings.each do |regexp, attribute|
          next unless exclusive == exclusive?(attribute)
          str.scan(regexp) do
            capture = $~.size == 1 ? 0 : 1
    Severity: Minor
    Found in lib/rdoc/markup/attribute_manager.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 convert_attrs_matching_word_pairs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def convert_attrs_matching_word_pairs(str, attrs, exclusive)
        # first do matching ones
        tags = @matching_word_pairs.select { |start, bitmap|
          exclusive == exclusive?(bitmap)
        }.keys
    Severity: Minor
    Found in lib/rdoc/markup/attribute_manager.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

    There are no issues that match your filters.

    Category
    Status