rubygems/rubygems

View on GitHub

Showing 835 of 952 total issues

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

    def run
      Bundler.ui.silence do
        Bundler.definition.validate_runtime!
        Bundler.load.lock
      end
Severity: Minor
Found in bundler/lib/bundler/cli/show.rb - About 3 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 84 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

      update_bundler = options[:bundler]

Severity: Major
Found in bundler/lib/bundler/cli/update.rb - About 3 hrs to fix

    Class API has 28 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class API
          # This class provides the base to build source plugins
          # All the method here are required to build a source plugin (except
          # `uri_hash`, `gem_install_dir`; they are helpers).
          #
    Severity: Minor
    Found in bundler/lib/bundler/plugin/api/source.rb - About 3 hrs to fix

      Class CargoBuilder has 28 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class Gem::Ext::CargoBuilder < Gem::Ext::Builder
        attr_accessor :spec, :runner, :profile
      
        def initialize
          require_relative "../command"
      Severity: Minor
      Found in lib/rubygems/ext/cargo_builder.rb - About 3 hrs to fix

        Method initialize has 82 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def initialize(lockfile, dependencies, sources, unlock, ruby_version = nil, optional_groups = [], gemfiles = [])
              if [true, false].include?(unlock)
                @unlocking_bundler = false
                @unlocking = unlock
              else
        Severity: Major
        Found in bundler/lib/bundler/definition.rb - About 3 hrs to fix

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

              def run
                Bundler.definition.validate_runtime!
                path_option = options["path"]
                path_option = nil if path_option&.empty?
                Bundler.settings.set_command_option :bin, path_option if options["path"]
          Severity: Minor
          Found in bundler/lib/bundler/cli/binstubs.rb - About 3 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 a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
          Open

              def run
                unless Bundler.default_gemfile
                  Bundler.ui.error "Unable to find a Gemfile to lock"
                  exit 1
                end
          Severity: Minor
          Found in bundler/lib/bundler/cli/lock.rb - About 3 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 suggest_gems_from_name has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
          Open

            def suggest_gems_from_name(gem_name, type = :latest, num_results = 5)
              gem_name        = gem_name.downcase.tr("_-", "")
              max             = gem_name.size / 2
              names           = available_specs(type).first.values.flatten(1)
          
          
          Severity: Minor
          Found in lib/rubygems/spec_fetcher.rb - About 3 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_proxy? has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
          Open

              def self.use_proxy?(hostname, addr, port, no_proxy) # :nodoc:
                hostname = hostname.downcase
                dothostname = ".#{hostname}"
                no_proxy.scan(/([^:,\s]+)(?::(\d+))?/) {|p_host, p_port|
                  if !p_port || port == p_port.to_i
          Severity: Minor
          Found in lib/rubygems/vendor/uri/lib/uri/generic.rb - About 3 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 parse_resolv_conf has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
          Open

                def Config.parse_resolv_conf(filename)
                  nameserver = []
                  search = nil
                  ndots = 1
                  File.open(filename, 'rb') {|f|
          Severity: Minor
          Found in lib/rubygems/vendor/resolv/lib/resolv.rb - About 3 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 initialize_pattern has 80 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def initialize_pattern(opts = {})
                ret = {}
                ret[:ESCAPED] = escaped = (opts.delete(:ESCAPED) || PATTERN::ESCAPED)
                ret[:UNRESERVED] = unreserved = opts.delete(:UNRESERVED) || PATTERN::UNRESERVED
                ret[:RESERVED] = reserved = opts.delete(:RESERVED) || PATTERN::RESERVED
          Severity: Major
          Found in lib/rubygems/vendor/uri/lib/uri/rfc2396_parser.rb - About 3 hrs to fix

            File user_interaction.rb has 300 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            require_relative "deprecate"
            require_relative "text"
            
            ##
            # Module that defines the default UserInteraction.  Any class including this
            Severity: Minor
            Found in lib/rubygems/user_interaction.rb - About 3 hrs to fix

              Class ConfigFile has 27 methods (exceeds 20 allowed). Consider refactoring.
              Open

              class Gem::ConfigFile
                include Gem::UserInteraction
              
                DEFAULT_BACKTRACE = true
                DEFAULT_BULK_THRESHOLD = 1000
              Severity: Minor
              Found in lib/rubygems/config_file.rb - About 3 hrs to fix

                Class Requirement has 27 methods (exceeds 20 allowed). Consider refactoring.
                Open

                class Gem::Requirement
                  OPS = { # :nodoc:
                    "=" => lambda {|v, r| v == r },
                    "!=" => lambda {|v, r| v != r },
                    ">" => lambda {|v, r| v >  r },
                Severity: Minor
                Found in lib/rubygems/requirement.rb - About 3 hrs to fix

                  Method execute has 78 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def execute
                      install_dir = options[:install_dir]
                  
                      specification_record = install_dir ? Gem::SpecificationRecord.from_path(install_dir) : Gem::Specification.specification_record
                  
                  
                  Severity: Major
                  Found in lib/rubygems/commands/pristine_command.rb - About 3 hrs to fix

                    Method sort_versions has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def sort_versions(package, specs)
                          locked_version = package.locked_version
                    
                          result = specs.sort do |a, b|
                            unless package.prerelease_specified? || pre?
                    Severity: Minor
                    Found in bundler/lib/bundler/gem_version_promoter.rb - About 3 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 initialize has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def initialize(lockfile, dependencies, sources, unlock, ruby_version = nil, optional_groups = [], gemfiles = [])
                          if [true, false].include?(unlock)
                            @unlocking_bundler = false
                            @unlocking = unlock
                          else
                    Severity: Minor
                    Found in bundler/lib/bundler/definition.rb - About 3 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 create_timeout_thread has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def self.create_timeout_thread
                        watcher = Thread.new do
                          requests = []
                          while true
                            until QUEUE.empty? and !requests.empty? # wait to have at least one request
                    Severity: Minor
                    Found in lib/rubygems/vendor/timeout/lib/timeout.rb - About 3 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 merge_path has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def merge_path(base, rel)
                    
                          # RFC2396, Section 5.2, 5)
                          # RFC2396, Section 5.2, 6)
                          base_path = split_path(base)
                    Severity: Minor
                    Found in lib/rubygems/vendor/uri/lib/uri/generic.rb - About 3 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 77 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def run
                          check_for_deployment_mode!
                    
                          gems.each do |gem_name|
                            Bundler::CLI::Common.select_spec(gem_name)
                    Severity: Major
                    Found in bundler/lib/bundler/cli/outdated.rb - About 3 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language