File installer.rb
has 572 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_relative "installer_uninstaller_utils"
require_relative "exceptions"
require_relative "deprecate"
require_relative "package"
require_relative "ext"
Class Installer
has 53 methods (exceeds 20 allowed). Consider refactoring. Open
class Gem::Installer
extend Gem::Deprecate
##
# Paths where env(1) might live. Some systems are broken and have it in
Method check_executable_overwrite
has a Cognitive Complexity of 28 (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 install
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def install
pre_install_checks
run_pre_install_hooks
- 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 40 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 generate_bin
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def generate_bin # :nodoc:
return if spec.executables.nil? || spec.executables.empty?
ensure_writable_dir @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 install
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def install
pre_install_checks
run_pre_install_hooks
Method process_options
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process_options # :nodoc:
@options = {
bin_dir: nil,
env_shebang: false,
force: false,
Method shebang
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def shebang(bin_file_name)
path = File.join gem_dir, spec.bindir, bin_file_name
first_line = File.open(path, "rb", &:gets) || ""
if first_line.start_with?("#!")
Method shebang
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def shebang(bin_file_name)
path = File.join gem_dir, spec.bindir, bin_file_name
first_line = File.open(path, "rb", &:gets) || ""
if first_line.start_with?("#!")
- 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 verify_spec
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def verify_spec
unless Gem::Specification::VALID_NAME_PATTERN.match?(spec.name)
raise Gem::InstallError, "#{spec} has an invalid name"
end
- 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
- 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 9 (exceeds 5 allowed). Consider refactoring. Open
def check_that_user_bin_dir_is_in_path # :nodoc:
return if self.class.path_warning
user_bin_dir = @bin_dir || Gem.bindir(gem_home)
user_bin_dir = user_bin_dir.tr(File::ALT_SEPARATOR, File::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
Method generate_plugins
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def generate_plugins # :nodoc:
latest = Gem::Specification.latest_spec_for(spec.name)
return if latest && latest.version > spec.version
ensure_writable_dir @plugins_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 ensure_writable_dir
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def ensure_writable_dir(dir) # :nodoc:
begin
Dir.mkdir dir, *[options[:dir_mode] && 0o755].compact
rescue SystemCallError
raise unless File.directory? 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
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
Method run_post_build_hooks
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def run_post_build_hooks # :nodoc:
Gem.post_build_hooks.each do |hook|
next unless hook.call(self) == false
FileUtils.rm_rf gem_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 run_pre_install_hooks
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def run_pre_install_hooks # :nodoc:
Gem.pre_install_hooks.each do |hook|
next unless hook.call(self) == false
location = " at #{$1}" if hook.inspect =~ /[ @](.*:\d+)/
- 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
FIXME found Open
# FIXME: we should have a real Package class for this
- Exclude checks
TODO found Open
# TODO: detect a specially formatted comment instead of trying
- Exclude checks
TODO found Open
# TODO: Remove when rubygems no longer supports running on bundler older
- Exclude checks