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.
Method execute
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
def execute
@verbose = Gem.configuration.really_verbose
install_destdir = options[:destdir]
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],
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
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]
- Read upRead up
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
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
- Read upRead up
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?
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],
- Read upRead up
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
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)
- Read upRead up
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?
- Read upRead up
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',
- Read upRead up
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
- Read upRead up
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
- Read upRead up
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
- Read upRead up
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"