rubinius/rubinius

View on GitHub
library/rubygems.rb

Summary

Maintainability
F
3 days
Test Coverage

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

require 'rbconfig'
require 'thread'

module Gem
  VERSION = "2.7.5"
Severity: Major
Found in library/rubygems.rb - About 1 day to fix

    Method use_gemdeps has a Cognitive Complexity of 31 (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 library/rubygems.rb - About 4 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 load_yaml has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.load_yaml
        return if @yaml_loaded
        return unless defined?(gem)
    
        test_syck = ENV['TEST_SYCK']
    Severity: Minor
    Found in library/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 find_home has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.find_home
        windows = File::ALT_SEPARATOR
        if not windows or RUBY_VERSION >= '1.9' then
          File.expand_path "~"
        else
    Severity: Minor
    Found in library/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 use_gemdeps has 42 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 library/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 library/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 10 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.find_spec_for_exe name, exec_name, requirements
          dep = Gem::Dependency.new name, requirements
      
          loaded = Gem.loaded_specs[name]
      
      
      Severity: Minor
      Found in library/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 load_yaml has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def self.load_yaml
          return if @yaml_loaded
          return unless defined?(gem)
      
          test_syck = ENV['TEST_SYCK']
      Severity: Minor
      Found in library/rubygems.rb - About 1 hr to fix

        Method register_default_spec has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

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

          def self.write_binary(path, data)
            open(path, 'wb') do |io|
              begin
                io.flock(File::LOCK_EX)
              rescue *WRITE_BINARY_ERRORS
        Severity: Minor
        Found in library/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 | 002
        
            require 'fileutils'
        Severity: Minor
        Found in library/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