lib/rdoc/options.rb

Summary

Maintainability
F
6 days
Test Coverage

Method parse has 409 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def parse argv
    ignore_invalid = true

    argv.insert(0, *ENV['RDOCOPT'].split) if ENV['RDOCOPT']

Severity: Major
Found in lib/rdoc/options.rb - About 2 days to fix

    File options.rb has 798 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'optparse'
    require 'pathname'
    
    ##
    # RDoc::Options handles the parsing and storage of options
    Severity: Major
    Found in lib/rdoc/options.rb - About 1 day to fix

      Method parse has a Cognitive Complexity of 71 (exceeds 5 allowed). Consider refactoring.
      Open

        def parse argv
          ignore_invalid = true
      
          argv.insert(0, *ENV['RDOCOPT'].split) if ENV['RDOCOPT']
      
      
      Severity: Minor
      Found in lib/rdoc/options.rb - About 1 day 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 override has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

        def override map # :nodoc:
          if map.has_key?('encoding')
            encoding = map['encoding']
            @encoding = encoding ? Encoding.find(encoding) : encoding
          end
      Severity: Minor
      Found in lib/rdoc/options.rb - About 3 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

      Class Options has 24 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class RDoc::Options
      
        ##
        # The deprecated options.
      
      
      Severity: Minor
      Found in lib/rdoc/options.rb - About 2 hrs to fix

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

          def init_ivars # :nodoc:
            @dry_run = false
            @exclude = %w[
              ~\z \.orig\z \.rej\z \.bak\z
              \.gemspec\z
        Severity: Minor
        Found in lib/rdoc/options.rb - About 1 hr to fix

          Method override has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def override map # :nodoc:
              if map.has_key?('encoding')
                encoding = map['encoding']
                @encoding = encoding ? Encoding.find(encoding) : encoding
              end
          Severity: Minor
          Found in lib/rdoc/options.rb - About 1 hr to fix

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

              def self.load_options
                options_file = File.expand_path '.rdoc_options'
                return RDoc::Options.new unless File.exist? options_file
            
                RDoc.load_yaml
            Severity: Minor
            Found in lib/rdoc/options.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 finish has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              def finish
                if @write_options then
                  write_options
                  exit
                end
            Severity: Minor
            Found in lib/rdoc/options.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 check_files has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              def check_files
                @files.delete_if do |file|
                  if File.exist? file then
                    if File.readable? file then
                      false
            Severity: Minor
            Found in lib/rdoc/options.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

            There are no issues that match your filters.

            Category
            Status