rubygems/rubygems

View on GitHub

Showing 830 of 946 total issues

Method run has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
Open

    def run
      Bundler.ui.level = "warn" if options[:quiet]

      warn_if_root

Severity: Minor
Found in bundler/lib/bundler/cli/install.rb - About 1 day 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

File bundler.rb has 499 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require_relative "bundler/vendored_fileutils"
require "pathname"
require "rbconfig"

require_relative "bundler/errors"
Severity: Minor
Found in bundler/lib/bundler.rb - About 1 day to fix

    Method lazy_initialize has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
    Open

          def lazy_initialize
            @mutex.synchronize {
              unless @initialized
                @nameserver_port = []
                @use_ipv6 = nil
    Severity: Minor
    Found in lib/rubygems/vendor/resolv/lib/resolv.rb - About 7 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

    File settings.rb has 494 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module Bundler
      class Settings
        autoload :Mirror,  File.expand_path("mirror", __dir__)
        autoload :Mirrors, File.expand_path("mirror", __dir__)
        autoload :Validator, File.expand_path("settings/validator", __dir__)
    Severity: Minor
    Found in bundler/lib/bundler/settings.rb - About 7 hrs to fix

      Method run has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
      Open

          def run
            check_for_deployment_mode!
      
            gems.each do |gem_name|
              Bundler::CLI::Common.select_spec(gem_name)
      Severity: Minor
      Found in bundler/lib/bundler/cli/outdated.rb - About 7 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 connect has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
      Open

          def connect
            if use_ssl?
              # reference early to load OpenSSL before connecting,
              # as OpenSSL may take time to load.
              @ssl_context = OpenSSL::SSL::SSLContext.new
      Severity: Minor
      Found in lib/rubygems/vendor/net-http/lib/net/http.rb - About 7 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

      File dsl.rb has 484 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require_relative "dependency"
      require_relative "ruby_dsl"
      
      module Bundler
        class Dsl
      Severity: Minor
      Found in bundler/lib/bundler/dsl.rb - About 7 hrs to fix

        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
        Severity: Major
        Found in lib/rubygems/installer.rb - About 7 hrs to fix

          Class Settings has 51 methods (exceeds 20 allowed). Consider refactoring.
          Open

            class Settings
              autoload :Mirror,  File.expand_path("mirror", __dir__)
              autoload :Mirrors, File.expand_path("mirror", __dir__)
              autoload :Validator, File.expand_path("settings/validator", __dir__)
          
          
          Severity: Major
          Found in bundler/lib/bundler/settings.rb - About 7 hrs to fix

            Class Rubygems has 51 methods (exceeds 20 allowed). Consider refactoring.
            Open

                class Rubygems < Source
                  autoload :Remote, File.expand_path("rubygems/remote", __dir__)
            
                  # Ask for X gems per API request
                  API_REQUEST_SIZE = 50
            Severity: Major
            Found in bundler/lib/bundler/source/rubygems.rb - About 7 hrs to fix

              Method run has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
              Open

                  def run
                    Bundler.ui.level = "warn" if options[:quiet]
              
                    update_bundler = options[:bundler]
              
              
              Severity: Minor
              Found in bundler/lib/bundler/cli/update.rb - About 7 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 run has 176 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def run
                    Bundler.ui.confirm "Creating gem '#{name}'..."
              
                    underscored_name = name.tr("-", "_")
                    namespaced_path = name.tr("-", "/")
              Severity: Major
              Found in bundler/lib/bundler/cli/gem.rb - About 7 hrs to fix

                Method require has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
                Open

                  def require(path) # :doc:
                    return gem_original_require(path) unless Gem.discover_gems_on_require
                
                    RUBYGEMS_ACTIVATION_MONITOR.synchronize do
                      path = File.path(path)
                Severity: Minor
                Found in lib/rubygems/core_ext/kernel_require.rb - About 6 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

                Class CLI has 48 methods (exceeds 20 allowed). Consider refactoring.
                Open

                  class CLI < Thor
                    require_relative "cli/common"
                    require_relative "cli/install"
                
                    package_name "Bundler"
                Severity: Minor
                Found in bundler/lib/bundler/cli.rb - About 6 hrs to fix

                  Method extract_tar_gz has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def extract_tar_gz(io, destination_dir, pattern = "*") # :nodoc:
                      destination_dir = File.realpath(destination_dir)
                  
                      directories = []
                      symlinks = []
                  Severity: Minor
                  Found in lib/rubygems/package.rb - About 6 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

                  Class GitProxy has 47 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                        class GitProxy
                          attr_accessor :path, :uri, :branch, :tag, :ref, :explicit_ref
                          attr_writer :revision
                  
                          def initialize(path, uri, options = {}, revision = nil, git = nil)
                  Severity: Minor
                  Found in bundler/lib/bundler/source/git/git_proxy.rb - About 6 hrs to fix

                    File common.rb has 436 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    require_relative "rfc2396_parser"
                    require_relative "rfc3986_parser"
                    
                    module Gem::URI
                      include RFC2396_REGEXP
                    Severity: Minor
                    Found in lib/rubygems/vendor/uri/lib/uri/common.rb - About 6 hrs to fix

                      File package.rb has 432 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      require_relative "security"
                      require_relative "user_interaction"
                      
                      ##
                      # Example using a Gem::Package
                      Severity: Minor
                      Found in lib/rubygems/package.rb - About 6 hrs to fix

                        Class Git has 46 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                            class Git < Path
                              autoload :GitProxy, File.expand_path("git/git_proxy", __dir__)
                        
                              attr_reader :uri, :ref, :branch, :options, :glob, :submodules
                        
                        
                        Severity: Minor
                        Found in bundler/lib/bundler/source/git.rb - About 6 hrs to fix

                          Method encode_multipart_form_data has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def encode_multipart_form_data(out, params, opt)
                              charset = opt[:charset]
                              boundary = opt[:boundary]
                              require 'securerandom' unless defined?(SecureRandom)
                              boundary ||= SecureRandom.urlsafe_base64(40)
                          Severity: Minor
                          Found in lib/rubygems/vendor/net-http/lib/net/http/generic_request.rb - About 6 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

                          Severity
                          Category
                          Status
                          Source
                          Language