lib/rdoc/markup/pre_process.rb

Summary

Maintainability
D
2 days
Test Coverage

Method handle_directive has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
Open

  def handle_directive prefix, directive, param, code_object = nil,
                       encoding = nil
    blankline = "#{prefix.strip}\n"
    directive = directive.downcase

Severity: Minor
Found in lib/rdoc/markup/pre_process.rb - About 7 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_directive has 72 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def handle_directive prefix, directive, param, code_object = nil,
                       encoding = nil
    blankline = "#{prefix.strip}\n"
    directive = directive.downcase

Severity: Major
Found in lib/rdoc/markup/pre_process.rb - About 2 hrs to fix

    Method handle has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

      def handle text, code_object = nil, &block
        if RDoc::Comment === text then
          comment = text
          text = text.text
        end
    Severity: Minor
    Found in lib/rdoc/markup/pre_process.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_directive has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def handle_directive prefix, directive, param, code_object = nil,
                           encoding = nil
    Severity: Minor
    Found in lib/rdoc/markup/pre_process.rb - About 35 mins to fix

      Avoid too many return statements within this method.
      Open

            return blankline unless code_object
      Severity: Major
      Found in lib/rdoc/markup/pre_process.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

              return blankline unless RDoc::AnyMethod === code_object
        Severity: Major
        Found in lib/rdoc/markup/pre_process.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                return blankline unless code_object
          Severity: Major
          Found in lib/rdoc/markup/pre_process.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                  return blankline unless code_object
            Severity: Major
            Found in lib/rdoc/markup/pre_process.rb - About 30 mins to fix

              There are no issues that match your filters.

              Category
              Status