File installer.rb
has 482 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'rubygems/command'
require 'rubygems/exceptions'
require 'rubygems/package'
require 'rubygems/ext'
require 'rubygems/user_interaction'
Class Installer
has 43 methods (exceeds 20 allowed). Consider refactoring. Open
class Gem::Installer
##
# Paths where env(1) might live. Some systems are broken and have it in
# /bin
Method check_executable_overwrite
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def check_executable_overwrite filename # :nodoc:
return if @force
generated_bin = File.join @bin_dir, formatted_program_filename(filename)
- 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_bin
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def generate_bin # :nodoc:
return if spec.executables.nil? or spec.executables.empty?
begin
Dir.mkdir @bin_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 check_executable_overwrite
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def check_executable_overwrite filename # :nodoc:
return if @force
generated_bin = File.join @bin_dir, formatted_program_filename(filename)
Method shebang
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def shebang(bin_file_name)
ruby_name = RbConfig::CONFIG['ruby_install_name'] if @env_shebang
path = File.join gem_dir, spec.bindir, bin_file_name
first_line = File.open(path, "rb") {|file| file.gets}
- 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 shebang
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def shebang(bin_file_name)
ruby_name = RbConfig::CONFIG['ruby_install_name'] if @env_shebang
path = File.join gem_dir, spec.bindir, bin_file_name
first_line = File.open(path, "rb") {|file| file.gets}
Method install
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def install
pre_install_checks
FileUtils.rm_f File.join gem_home, 'specifications', spec.spec_name
Method install
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def install
pre_install_checks
FileUtils.rm_f File.join gem_home, 'specifications', spec.spec_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 generate_bin_symlink
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def generate_bin_symlink(filename, bindir)
src = File.join gem_dir, spec.bindir, filename
dst = File.join bindir, formatted_program_filename(filename)
if File.exist? dst 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 process_options
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process_options # :nodoc:
@options = {
:bin_dir => nil,
:env_shebang => false,
:force => false,
Method initialize
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def initialize(package, options={})
require 'fileutils'
@options = options
if package.is_a? String
- 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 check_that_user_bin_dir_is_in_path
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def check_that_user_bin_dir_is_in_path # :nodoc:
user_bin_dir = @bin_dir || Gem.bindir(gem_home)
user_bin_dir = user_bin_dir.gsub(File::SEPARATOR, File::ALT_SEPARATOR) if
File::ALT_SEPARATOR
- 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
Avoid too many return
statements within this method. Open
return if ask_yes_no "#{question}\nOverwrite the executable?", false
Avoid too many return
statements within this method. Open
return if ask_yes_no "#{question}\nOverwrite the executable?", false