lib/rdoc/ri/driver.rb

Summary

Maintainability
F
1 wk
Test Coverage

File driver.rb has 960 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'optparse'

require_relative '../../rdoc'

require_relative 'formatter' # For RubyGems backwards compatibility
Severity: Major
Found in lib/rdoc/ri/driver.rb - About 2 days to fix

    Class Driver has 60 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class RDoc::RI::Driver
    
      ##
      # Base Driver error class
    
    
    Severity: Major
    Found in lib/rdoc/ri/driver.rb - About 1 day to fix

      Method process_args has 184 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def self.process_args argv
          options = default_options
      
          opts = OptionParser.new do |opt|
            opt.accept File do |file,|
      Severity: Major
      Found in lib/rdoc/ri/driver.rb - About 7 hrs to fix

        Method interactive has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

          def interactive
            puts "\nEnter the method name you want to look up."
        
            begin
              require 'readline'
        Severity: Minor
        Found in lib/rdoc/ri/driver.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 list_methods_matching has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

          def list_methods_matching name
            found = []
        
            find_methods name do |store, klass, ancestor, types, method|
              if types == :instance or types == :both then
        Severity: Minor
        Found in lib/rdoc/ri/driver.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 display_name has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

          def display_name name
            if name =~ /\w:(\w|$)/ then
              display_page name
              return true
            end
        Severity: Minor
        Found in lib/rdoc/ri/driver.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 lookup_method has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

          def lookup_method name
            found = load_methods_matching name
        
            if found.empty?
              if check_did_you_mean
        Severity: Minor
        Found in lib/rdoc/ri/driver.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 process_args has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

          def self.process_args argv
            options = default_options
        
            opts = OptionParser.new do |opt|
              opt.accept File do |file,|
        Severity: Minor
        Found in lib/rdoc/ri/driver.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 setup_pager has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

          def setup_pager
            return if @use_stdout
        
            pagers = [ENV['RI_PAGER'], ENV['PAGER'], 'pager', 'less', 'more']
        
        
        Severity: Minor
        Found in lib/rdoc/ri/driver.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 complete_klass has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

          def complete_klass name, klass, selector, method, completions # :nodoc:
            klasses = classes.keys
        
            # may need to include Foo when given Foo::
            klass_name = method ? name : klass
        Severity: Minor
        Found in lib/rdoc/ri/driver.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 add_class has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

          def add_class out, name, classes
            heading = if classes.all? { |klass| klass.module? } then
                        name
                      else
                        superclass = classes.map do |klass|
        Severity: Minor
        Found in lib/rdoc/ri/driver.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 interactive has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def interactive
            puts "\nEnter the method name you want to look up."
        
            begin
              require 'readline'
        Severity: Minor
        Found in lib/rdoc/ri/driver.rb - About 1 hr to fix

          Method find_methods has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def find_methods name
              klass, selector, method = parse_name name
          
              types = method_type selector
          
          
          Severity: Minor
          Found in lib/rdoc/ri/driver.rb - About 1 hr to fix

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

              def ancestors_of klass
                ancestors = []
            
                unexamined = [klass]
                seen = []
            Severity: Minor
            Found in lib/rdoc/ri/driver.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 parse_name has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

              def parse_name name
                parts = name.split(/(::?|#|\.)/)
            
                if parts.length == 1 then
                  if parts.first =~ /^[a-z]|^([%&*+\/<>^`|~-]|\+@|-@|<<|<=>?|===?|=>|=~|>>|\[\]=?|~@)$/ then
            Severity: Minor
            Found in lib/rdoc/ri/driver.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 list_known_classes has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

              def list_known_classes names = []
                classes = []
            
                stores.each do |store|
                  classes << store.module_names
            Severity: Minor
            Found in lib/rdoc/ri/driver.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 find_methods has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              def find_methods name
                klass, selector, method = parse_name name
            
                types = method_type selector
            
            
            Severity: Minor
            Found in lib/rdoc/ri/driver.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 run has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              def run
                if @list_doc_dirs then
                  puts @doc_dirs
                elsif @list then
                  list_known_classes @names
            Severity: Minor
            Found in lib/rdoc/ri/driver.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 complete_klass has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              def complete_klass name, klass, selector, method, completions # :nodoc:
            Severity: Minor
            Found in lib/rdoc/ri/driver.rb - About 35 mins to fix

              Method load_method has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                def load_method store, cache, klass, type, name
              Severity: Minor
              Found in lib/rdoc/ri/driver.rb - About 35 mins to fix

                Method class_document has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                  def class_document name, found, klasses, includes, extends
                Severity: Minor
                Found in lib/rdoc/ri/driver.rb - About 35 mins to fix

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

                    def check_did_you_mean # :nodoc:
                      if defined? DidYouMean::SpellChecker
                        true
                      else
                        begin
                  Severity: Minor
                  Found in lib/rdoc/ri/driver.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

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

                    def load_method store, cache, klass, type, name
                      methods = store.public_send(cache)[klass]
                  
                      return unless methods
                  
                  
                  Severity: Minor
                  Found in lib/rdoc/ri/driver.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

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

                    def display_page name
                      store_name, page_name = name.split ':', 2
                  
                      store = @stores.find { |s| s.source == store_name }
                  
                  
                  Severity: Minor
                  Found in lib/rdoc/ri/driver.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

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

                    def render_method_comment out, method, alias_for = nil# :nodoc:
                      if alias_for
                        unless method.comment.nil? or method.comment.empty?
                          out << RDoc::Markup::BlankLine.new
                          out << method.comment
                  Severity: Minor
                  Found in lib/rdoc/ri/driver.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

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

                    def render_class out, store, klass, also_in # :nodoc:
                      comment = klass.comment
                      # TODO the store's cache should always return an empty Array
                      class_methods    = store.class_methods[klass.full_name]    || []
                      instance_methods = store.instance_methods[klass.full_name] || []
                  Severity: Minor
                  Found in lib/rdoc/ri/driver.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

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

                    def classes_and_includes_and_extends_for name
                      klasses = []
                      extends = []
                      includes = []
                  
                  
                  Severity: Minor
                  Found in lib/rdoc/ri/driver.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