lib/rdoc/class_module.rb

Summary

Maintainability
F
3 days
Test Coverage

File class_module.rb has 476 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class RDoc::ClassModule < RDoc::Context

  ##
  # 1::
  #   RDoc 3.7
Severity: Minor
Found in lib/rdoc/class_module.rb - About 7 hrs to fix

    Class ClassModule has 38 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class RDoc::ClassModule < RDoc::Context
    
      ##
      # 1::
      #   RDoc 3.7
    Severity: Minor
    Found in lib/rdoc/class_module.rb - About 5 hrs to fix

      Method marshal_load has 66 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def marshal_load array # :nodoc:
          initialize_visibility
          initialize_methods_etc
          @current_section   = nil
          @document_self     = true
      Severity: Major
      Found in lib/rdoc/class_module.rb - About 2 hrs to fix

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

          def marshal_dump # :nodoc:
            attrs = attributes.sort.map do |attr|
              next unless attr.display?
              [ attr.name, attr.rw,
                attr.visibility, attr.singleton, attr.file_name,
        Severity: Minor
        Found in lib/rdoc/class_module.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 merge has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

          def merge class_module
            @parent      = class_module.parent
            @parent_name = class_module.parent_name
        
            other_document = parse class_module.comment_location
        Severity: Minor
        Found in lib/rdoc/class_module.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 merge has 52 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def merge class_module
            @parent      = class_module.parent
            @parent_name = class_module.parent_name
        
            other_document = parse class_module.comment_location
        Severity: Major
        Found in lib/rdoc/class_module.rb - About 2 hrs to fix

          Method from_module has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def self.from_module class_type, mod
              klass = class_type.new mod.name
          
              mod.comment_location.each do |comment, location|
                klass.add_comment comment, location
          Severity: Minor
          Found in lib/rdoc/class_module.rb - About 1 hr to fix

            Method marshal_dump has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def marshal_dump # :nodoc:
                attrs = attributes.sort.map do |attr|
                  next unless attr.display?
                  [ attr.name, attr.rw,
                    attr.visibility, attr.singleton, attr.file_name,
            Severity: Minor
            Found in lib/rdoc/class_module.rb - About 1 hr to fix

              Method marshal_load has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                def marshal_load array # :nodoc:
                  initialize_visibility
                  initialize_methods_etc
                  @current_section   = nil
                  @document_self     = true
              Severity: Minor
              Found in lib/rdoc/class_module.rb - About 1 hr 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 update_aliases has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                def update_aliases
                  constants.each do |const|
                    next unless cm = const.is_alias_for
                    cm_alias = cm.dup
                    cm_alias.name = const.name
              Severity: Minor
              Found in lib/rdoc/class_module.rb - About 1 hr 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 merge_sections has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def merge_sections cm # :nodoc:
                  my_sections    =    sections.group_by { |section| section.title }
                  other_sections = cm.sections.group_by { |section| section.title }
              
                  other_files = cm.in_files
              Severity: Minor
              Found in lib/rdoc/class_module.rb - About 1 hr to fix

                Method merge_sections has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                  def merge_sections cm # :nodoc:
                    my_sections    =    sections.group_by { |section| section.title }
                    other_sections = cm.sections.group_by { |section| section.title }
                
                    other_files = cm.in_files
                Severity: Minor
                Found in lib/rdoc/class_module.rb - About 55 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 each_ancestor has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                  def each_ancestor # :yields: module
                    return enum_for __method__ unless block_given?
                
                    ancestors.each do |mod|
                      next if String === mod
                Severity: Minor
                Found in lib/rdoc/class_module.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 remove_nodoc_children has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  def remove_nodoc_children
                    prefix = self.full_name + '::'
                
                    modules_hash.each_key do |name|
                      full_name = prefix + name
                Severity: Minor
                Found in lib/rdoc/class_module.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