rubygems/rubygems

View on GitHub

Showing 831 of 947 total issues

Method find_proxy has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

    def find_proxy(env=ENV)
      raise BadURIError, "relative Gem::URI: #{self}" if self.relative?
      name = self.scheme.downcase + '_proxy'
      proxy_uri = nil
      if name == 'http_proxy' && env.include?('REQUEST_METHOD') # CGI?
Severity: Minor
Found in lib/rubygems/vendor/uri/lib/uri/generic.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 run has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

    def run
      CLI::Common.ensure_all_gems_in_lockfile!(@gems)
      definition = Bundler.definition
      definition.validate_runtime!
      installer = Bundler::Installer.new(Bundler.root, definition)
Severity: Minor
Found in bundler/lib/bundler/cli/pristine.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 alien has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

  def alien(gems=[])
    errors = Hash.new {|h,k| h[k] = {} }

    Gem::Specification.each do |spec|
      unless gems.empty?
Severity: Minor
Found in lib/rubygems/validator.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

File resolver.rb has 364 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Bundler
  #
  # This class implements the interface needed by PubGrub for resolution. It is
  # equivalent to the `PubGrub::BasicPackageSource` class provided by PubGrub by
  # default and used by the most simple PubGrub consumers.
Severity: Minor
Found in bundler/lib/bundler/resolver.rb - About 4 hrs to fix

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

        def require(*groups)
          groups.map!(&:to_sym)
          groups = [:default] if groups.empty?
    
          dependencies = @definition.dependencies.select do |dep|
    Severity: Minor
    Found in bundler/lib/bundler/runtime.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

    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

      Class SpecSet has 35 methods (exceeds 20 allowed). Consider refactoring.
      Open

        class SpecSet
          include Enumerable
          include TSort
      
          attr_reader :incomplete_specs
      Severity: Minor
      Found in bundler/lib/bundler/spec_set.rb - About 4 hrs to fix

        Class SpecificationPolicy has 35 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class Gem::SpecificationPolicy
          include Gem::UserInteraction
        
          VALID_NAME_PATTERN = /\A[a-zA-Z0-9\.\-\_]+\z/ # :nodoc:
        
        
        Severity: Minor
        Found in lib/rubygems/specification_policy.rb - About 4 hrs to fix

          File git_proxy.rb has 354 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          module Bundler
            class Source
              class Git
                class GitNotInstalledError < GitError
                  def initialize
          Severity: Minor
          Found in bundler/lib/bundler/source/git/git_proxy.rb - About 4 hrs to fix

            File config_file.rb has 349 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            require_relative "user_interaction"
            require "rbconfig"
            
            ##
            # Gem::ConfigFile RubyGems options and gem command options from gemrc.
            Severity: Minor
            Found in lib/rubygems/config_file.rb - About 4 hrs to fix

              Method replace_gem has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
              Open

                  def replace_gem(specs, specs_by_name)
                    executables = nil
              
                    [::Kernel.singleton_class, ::Kernel].each do |kernel_class|
                      redefine_method(kernel_class, :gem) do |dep, *reqs|
              Severity: Minor
              Found in bundler/lib/bundler/rubygems_integration.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 find_gems_with_sources has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
              Open

                def find_gems_with_sources(dep, best_only=false) # :nodoc:
                  set = Gem::AvailableSet.new
              
                  if consider_local?
                    sl = Gem::Source::Local.new
              Severity: Minor
              Found in lib/rubygems/dependency_installer.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

              File to_ruby.rb has 341 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              require_relative "visitor"
              
              module Gem::SafeMarshal
                module Visitors
                  class ToRuby < Visitor
              Severity: Minor
              Found in lib/rubygems/safe_marshal/visitors/to_ruby.rb - About 4 hrs to fix

                Method generate_bundler_executable_stubs has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                Open

                    def generate_bundler_executable_stubs(spec, options = {})
                      if options[:binstubs_cmd] && spec.executables.empty?
                        options = {}
                        spec.runtime_dependencies.each do |dep|
                          bins = @definition.specs[dep].first.executables
                Severity: Minor
                Found in bundler/lib/bundler/installer.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 check_executable_overwrite has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                Open

                  def check_executable_overwrite(filename) # :nodoc:
                    return if @force
                
                    generated_bin = File.join @bin_dir, formatted_program_filename(filename)
                
                
                Severity: Minor
                Found in lib/rubygems/installer.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

                Class Resolver has 32 methods (exceeds 20 allowed). Consider refactoring.
                Open

                  class Resolver
                    require_relative "vendored_pub_grub"
                    require_relative "resolver/base"
                    require_relative "resolver/candidate"
                    require_relative "resolver/incompatibility"
                Severity: Minor
                Found in bundler/lib/bundler/resolver.rb - About 4 hrs to fix

                  Class BasicSpecification has 32 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  class Gem::BasicSpecification
                    ##
                    # Allows installation of extensions for git: gems.
                  
                    attr_writer :base_dir # :nodoc:
                  Severity: Minor
                  Found in lib/rubygems/basic_specification.rb - About 4 hrs to fix

                    Method replace_bin_path has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def replace_bin_path(specs_by_name)
                          gem_class = (class << Gem; self; end)
                    
                          redefine_method(gem_class, :find_spec_for_exe) do |gem_name, *args|
                            exec_name = args.first
                    Severity: Minor
                    Found in bundler/lib/bundler/rubygems_integration.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 normalize_options has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def normalize_options(name, version, opts)
                          if name.is_a?(Symbol)
                            raise GemfileError, %(You need to specify gem names as Strings. Use 'gem "#{name}"' instead)
                          end
                          if /\s/.match?(name)
                    Severity: Minor
                    Found in bundler/lib/bundler/dsl.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 gem_platforms has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def gem_platforms(name, options) # :nodoc:
                        platform_names = Array(options.delete(:platform))
                        platform_names.concat Array(options.delete(:platforms))
                        platform_names.concat @current_platforms if @current_platforms
                    
                    
                    Severity: Minor
                    Found in lib/rubygems/request_set/gem_dependency_api.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

                    Severity
                    Category
                    Status
                    Source
                    Language