rubygems/rubygems

View on GitHub
lib/rubygems.rb

Summary

Maintainability
D
2 days
Test Coverage

File rubygems.rb has 648 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "rbconfig"

module Gem
  VERSION = "3.6.0.dev"
end
Severity: Major
Found in lib/rubygems.rb - About 1 day to fix

    Method use_gemdeps has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.use_gemdeps(path = nil)
        raise_exception = path
    
        path ||= ENV["RUBYGEMS_GEMDEPS"]
        return unless path
    Severity: Minor
    Found in lib/rubygems.rb - About 2 hrs 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 open_file has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.open_file(path, flags, &block)
        File.open(path, flags) do |io|
          if !java_platform? && win_platform?
            begin
              io.flock(File::LOCK_EX)
    Severity: Minor
    Found in lib/rubygems.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 use_gemdeps has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def self.use_gemdeps(path = nil)
        raise_exception = path
    
        path ||= ENV["RUBYGEMS_GEMDEPS"]
        return unless path
    Severity: Minor
    Found in lib/rubygems.rb - About 1 hr to fix

      Method paths= has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.paths=(env)
          clear_paths
          target = {}
          env.each_pair do |k,v|
            case k
      Severity: Minor
      Found in lib/rubygems.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 register_default_spec has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def register_default_spec(spec)
            extended_require_paths = spec.require_paths.map {|f| f + "/" }
            new_format = extended_require_paths.any? {|path| spec.files.any? {|f| f.start_with? path } }
      
            if new_format
      Severity: Minor
      Found in lib/rubygems.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 find_spec_for_exe has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.find_spec_for_exe(name, exec_name, requirements)
          raise ArgumentError, "you must supply exec_name" unless exec_name
      
          dep = Gem::Dependency.new name, requirements
      
      
      Severity: Minor
      Found in lib/rubygems.rb - About 35 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 ruby_version has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.ruby_version
          return @ruby_version if defined? @ruby_version
          version = RUBY_VERSION.dup
      
          if RUBY_PATCHLEVEL == -1
      Severity: Minor
      Found in lib/rubygems.rb - About 35 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 try_activate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.try_activate(path)
          # finds the _latest_ version... regardless of loaded specs and their deps
          # if another gem had a requirement that would mean we shouldn't
          # activate the latest version, then either it would already be activated
          # or if it was ambiguous (and thus unresolved) the code in our custom
      Severity: Minor
      Found in lib/rubygems.rb - About 35 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 ensure_subdirectories has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.ensure_subdirectories(dir, mode, subdirs) # :nodoc:
          old_umask = File.umask
          File.umask old_umask | 0o002
      
          options = {}
      Severity: Minor
      Found in lib/rubygems.rb - About 25 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

      There are no issues that match your filters.

      Category
      Status