rubinius/rubinius

View on GitHub
library/rubygems/commands/setup_command.rb

Summary

Maintainability
F
3 days
Test Coverage

File setup_command.rb has 441 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'rubygems/command'

##
# Installs RubyGems itself.  This command is ordinarily only available from a
# RubyGems checkout or tarball.
Severity: Minor
Found in library/rubygems/commands/setup_command.rb - About 6 hrs to fix

    Method execute has 67 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def execute
        @verbose = Gem.configuration.really_verbose
    
        install_destdir = options[:destdir]
    
    
    Severity: Major
    Found in library/rubygems/commands/setup_command.rb - About 2 hrs to fix

      Method initialize has 63 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def initialize
          require 'tmpdir'
      
          super 'setup', 'Install RubyGems',
                :format_executable => true, :document => %w[ri],
      Severity: Major
      Found in library/rubygems/commands/setup_command.rb - About 2 hrs to fix

        Class SetupCommand has 21 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class Gem::Commands::SetupCommand < Gem::Command
          HISTORY_HEADER = /^===\s*[\d.]+\s*\/\s*\d{4}-\d{2}-\d{2}\s*$/
          VERSION_MATCHER = /^===\s*([\d.]+)\s*\/\s*\d{4}-\d{2}-\d{2}\s*$/
        
          def initialize
        Severity: Minor
        Found in library/rubygems/commands/setup_command.rb - About 2 hrs to fix

          Method execute has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

            def execute
              @verbose = Gem.configuration.really_verbose
          
              install_destdir = options[:destdir]
          
          
          Severity: Minor
          Found in library/rubygems/commands/setup_command.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 install_executables has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def install_executables(bin_dir)
              @bin_file_names = []
          
              executables = { 'gem' => 'bin' }
              executables['bundler'] = 'bundler/exe' if Gem::USE_BUNDLER_FOR_GEMDEPS
          Severity: Minor
          Found in library/rubygems/commands/setup_command.rb - About 1 hr to fix

            Method install_executables has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

              def install_executables(bin_dir)
                @bin_file_names = []
            
                executables = { 'gem' => 'bin' }
                executables['bundler'] = 'bundler/exe' if Gem::USE_BUNDLER_FOR_GEMDEPS
            Severity: Minor
            Found in library/rubygems/commands/setup_command.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 install_default_bundler_gem has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def install_default_bundler_gem
                return unless Gem::USE_BUNDLER_FOR_GEMDEPS
            
                specs_dir = Gem::Specification.default_specifications_dir
                File.join(options[:destdir], specs_dir) unless Gem.win_platform?
            Severity: Minor
            Found in library/rubygems/commands/setup_command.rb - About 1 hr to fix

              Method initialize has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                def initialize
                  require 'tmpdir'
              
                  super 'setup', 'Install RubyGems',
                        :format_executable => true, :document => %w[ri],
              Severity: Minor
              Found in library/rubygems/commands/setup_command.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 install_rdoc has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def install_rdoc
                  gem_doc_dir = File.join Gem.dir, 'doc'
                  rubygems_name = "rubygems-#{Gem::VERSION}"
                  rubygems_doc_dir = File.join gem_doc_dir, rubygems_name
              
              
              Severity: Minor
              Found in library/rubygems/commands/setup_command.rb - About 1 hr to fix

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

                  def remove_old_lib_files lib_dir
                    lib_dirs = { File.join(lib_dir, 'rubygems') => 'lib/rubygems' }
                    lib_dirs[File.join(lib_dir, 'bundler')] = 'bundler/lib/bundler' if Gem::USE_BUNDLER_FOR_GEMDEPS
                    lib_dirs.each do |old_lib_dir, new_lib_dir|
                      lib_files = rb_files_in(new_lib_dir)
                Severity: Minor
                Found in library/rubygems/commands/setup_command.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 install_default_bundler_gem has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                  def install_default_bundler_gem
                    return unless Gem::USE_BUNDLER_FOR_GEMDEPS
                
                    specs_dir = Gem::Specification.default_specifications_dir
                    File.join(options[:destdir], specs_dir) unless Gem.win_platform?
                Severity: Minor
                Found in library/rubygems/commands/setup_command.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 remove_old_bin_files has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                  def remove_old_bin_files(bin_dir)
                    old_bin_files = {
                      'gem_mirror' => 'gem mirror',
                      'gem_server' => 'gem server',
                      'gemlock' => 'gem lock',
                Severity: Minor
                Found in library/rubygems/commands/setup_command.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 install_rdoc has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  def install_rdoc
                    gem_doc_dir = File.join Gem.dir, 'doc'
                    rubygems_name = "rubygems-#{Gem::VERSION}"
                    rubygems_doc_dir = File.join gem_doc_dir, rubygems_name
                
                
                Severity: Minor
                Found in library/rubygems/commands/setup_command.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 show_release_notes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  def show_release_notes
                    release_notes = File.join Dir.pwd, 'History.txt'
                
                    release_notes =
                      if File.exist? release_notes then
                Severity: Minor
                Found in library/rubygems/commands/setup_command.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 generate_default_dirs has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  def generate_default_dirs(install_destdir)
                    prefix = options[:prefix]
                    site_or_vendor = options[:site_or_vendor]
                
                    if prefix.empty? then
                Severity: Minor
                Found in library/rubygems/commands/setup_command.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