bundler/bundler

View on GitHub

Showing 262 of 280 total issues

Class Shell has 22 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Shell
      LEVELS = %w[silent error warn confirm info debug].freeze

      attr_writer :shell

Severity: Minor
Found in lib/bundler/ui/shell.rb - About 2 hrs to fix

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

        def self.environment
          out = []
    
          out << ["Bundler", Bundler::VERSION]
          out << ["  Platforms", Gem.platforms.join(", ")]
    Severity: Minor
    Found in lib/bundler/env.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 cache has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def cache(custom_path = nil)
          cache_path = Bundler.app_cache(custom_path)
          SharedHelpers.filesystem_access(cache_path) do |p|
            FileUtils.mkdir_p(p)
          end unless File.exist?(cache_path)
    Severity: Minor
    Found in lib/bundler/runtime.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 load_spec_files has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

          def load_spec_files
            index = Index.new
    
            if File.directory?(expanded_path)
              # We sort depth-first since `<<` will override the earlier-found specs
    Severity: Minor
    Found in lib/bundler/source/path.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 search_for has 55 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def search_for(dependency)
          platform = dependency.__platform
          dependency = dependency.dep unless dependency.is_a? Gem::Dependency
          search = @search_for[dependency] ||= begin
            index = index_for(dependency)
    Severity: Major
    Found in lib/bundler/resolver.rb - About 2 hrs to fix

      Method generate_bundler_executable_stubs has 55 lines of code (exceeds 25 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: Major
      Found in lib/bundler/installer.rb - About 2 hrs to fix

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

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

          Method clean has 54 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def clean(dry_run = false)
                gem_bins             = Dir["#{Gem.dir}/bin/*"]
                git_dirs             = Dir["#{Gem.dir}/bundler/gems/*"]
                git_cache_dirs       = Dir["#{Gem.dir}/cache/bundler/git/*"]
                gem_dirs             = Dir["#{Gem.dir}/gems/*"]
          Severity: Major
          Found in lib/bundler/runtime.rb - About 2 hrs to fix

            Method clean has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                def clean(dry_run = false)
                  gem_bins             = Dir["#{Gem.dir}/bin/*"]
                  git_dirs             = Dir["#{Gem.dir}/bundler/gems/*"]
                  git_cache_dirs       = Dir["#{Gem.dir}/cache/bundler/git/*"]
                  gem_dirs             = Dir["#{Gem.dir}/gems/*"]
            Severity: Minor
            Found in lib/bundler/runtime.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 generate_bin has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                  def generate_bin(spec, options = {})
                    gem_dir = Pathname.new(spec.full_gem_path)
            
                    # Some gem authors put absolute paths in their gemspec
                    # and we have to save them from themselves
            Severity: Minor
            Found in lib/bundler/source/path.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 converge_locked_specs has 52 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def converge_locked_specs
                  deps = []
            
                  # Build a list of dependencies that are the same in the Gemfile
                  # and Gemfile.lock. If the Gemfile modified a dependency, but
            Severity: Major
            Found in lib/bundler/definition.rb - About 2 hrs to fix

              File fetcher.rb has 253 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              require_relative "vendored_persistent"
              require "cgi"
              require "securerandom"
              require "zlib"
              require "rubygems/request"
              Severity: Minor
              Found in lib/bundler/fetcher.rb - About 2 hrs to fix

                Method normalize_options has 50 lines of code (exceeds 25 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 name =~ /\s/
                Severity: Minor
                Found in lib/bundler/dsl.rb - About 2 hrs to fix

                  Method define_task has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def self.define_task(context, task_method = :task, opts = {})
                        if defined?(Capistrano) && context.is_a?(Capistrano::Configuration)
                          context_name = "capistrano"
                          role_default = "{:except => {:no_release => true}}"
                          error_type = ::Capistrano::CommandError
                  Severity: Minor
                  Found in lib/bundler/deployment.rb - About 2 hrs to fix

                    Method update has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          def update(local_path, remote_path, retrying = nil)
                            headers = {}
                    
                            Dir.mktmpdir("bundler-compact-index-") do |local_temp_dir|
                              local_temp_path = Pathname.new(local_temp_dir).join(local_path.basename)
                    Severity: Minor
                    Found in lib/bundler/compact_index_client/updater.rb - About 1 hr to fix

                      Method replace_bin_path has 49 lines of code (exceeds 25 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 lib/bundler/rubygems_integration.rb - About 1 hr to fix

                        Method materialize has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def materialize(deps, missing_specs = nil)
                              materialized = self.for(deps, [], false, true, !missing_specs).to_a
                              deps = materialized.map(&:name).uniq
                              materialized.map! do |s|
                                next s unless s.is_a?(LazySpecification)
                        Severity: Minor
                        Found in lib/bundler/spec_set.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 sort_dependencies has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def sort_dependencies(dependencies, activated, conflicts)
                              dependencies.sort_by do |dependency|
                                dependency.all_sources = relevant_sources_for_vertex(activated.vertex_named(dependency.name))
                                name = name_for(dependency)
                                vertex = activated.vertex_named(name)
                        Severity: Minor
                        Found in lib/bundler/resolver.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 <=> has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                        Open

                                def <=>(other)
                                  if version.equal?(INFINITY)
                                    return 0 if other.version.equal?(INFINITY)
                                    return 1
                                  elsif other.version.equal?(INFINITY)
                        Severity: Minor
                        Found in lib/bundler/version_ranges.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 initialize has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def initialize(lockfile)
                              @platforms    = []
                              @sources      = []
                              @dependencies = {}
                              @state        = nil
                        Severity: Minor
                        Found in lib/bundler/lockfile_parser.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

                        Severity
                        Category
                        Status
                        Source
                        Language