lib/rubygems/command.rb
Class Command
has 44 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Gem::Command
include Gem::UserInteraction
Gem::OptionParser.accept Symbol, &:to_sym
File command.rb
has 355 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
require_relative "vendored_optparse"
require_relative "requirement"
require_relative "user_interaction"
##
Method show_lookup_failure
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
def show_lookup_failure(gem_name, version, errors, suppress_suggestions = false, required_by = nil)
gem = "'#{gem_name}' (#{version})"
msg = String.new "Could not find a valid gem #{gem}"
if errors && !errors.empty?
- 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_deprecated_options
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
def check_deprecated_options(options)
options.each do |option|
next unless option_is_deprecated?(option)
deprecation = @deprecated_options[command][option]
version_to_expire = deprecation["rg_version_to_expire"]
- 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_lookup_failure
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def show_lookup_failure(gem_name, version, errors, suppress_suggestions = false, required_by = nil)