rubygems/rubygems

View on GitHub
lib/rubygems/command.rb

Summary

Maintainability
D
1 day
Test Coverage

Class Command has 44 methods (exceeds 20 allowed). Consider refactoring.
Open

class Gem::Command
  include Gem::UserInteraction

  Gem::OptionParser.accept Symbol, &:to_sym

Severity: Minor
Found in lib/rubygems/command.rb - About 6 hrs to fix

    File command.rb has 355 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require_relative "vendored_optparse"
    require_relative "requirement"
    require_relative "user_interaction"
    
    ##
    Severity: Minor
    Found in lib/rubygems/command.rb - About 4 hrs to fix

      Method show_lookup_failure has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      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?
      Severity: Minor
      Found in lib/rubygems/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 check_deprecated_options has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      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"]
      Severity: Minor
      Found in lib/rubygems/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 show_lookup_failure has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        def show_lookup_failure(gem_name, version, errors, suppress_suggestions = false, required_by = nil)
      Severity: Minor
      Found in lib/rubygems/command.rb - About 35 mins to fix

        There are no issues that match your filters.

        Category
        Status