bundler/bundler

View on GitHub

Showing 262 of 280 total issues

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

    def run
      editor = [ENV["BUNDLER_EDITOR"], ENV["VISUAL"], ENV["EDITOR"]].find {|e| !e.nil? && !e.empty? }
      return Bundler.ui.info("To open a bundled gem, set $EDITOR or $BUNDLER_EDITOR") unless editor
      return unless spec = Bundler::CLI::Common.select_spec(name, :regex_match)
      if spec.default_gem?
Severity: Minor
Found in lib/bundler/cli/open.rb - About 45 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_safe_gem_name has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def ensure_safe_gem_name(name, constant_array)
      if name =~ /^\d/
        Bundler.ui.error "Invalid gem name #{name} Please give a name which does not start with numbers."
        exit 1
      end
Severity: Minor
Found in lib/bundler/cli/gem.rb - About 45 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 kernel_load has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def kernel_load(file, *args)
      args.pop if args.last.is_a?(Hash)
      ARGV.replace(args)
      $0 = file
      Process.setproctitle(process_title(file, args)) if Process.respond_to?(:setproctitle)
Severity: Minor
Found in lib/bundler/cli/exec.rb - About 45 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 for has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def for(dependencies, skip = [], check = false, match_current_platform = false, raise_on_missing = true)
Severity: Minor
Found in lib/bundler/spec_set.rb - About 35 mins to fix

    Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def initialize(installer, all_specs, size, standalone, force)
    Severity: Minor
    Found in lib/bundler/installer/parallel_installer.rb - About 35 mins to fix

      Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def initialize(name, version, platform, dependencies, metadata = nil)
      Severity: Minor
      Found in lib/bundler/endpoint_specification.rb - About 35 mins to fix

        Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def initialize(spec, installer, standalone = false, worker = 0, force = false)
        Severity: Minor
        Found in lib/bundler/installer/gem_installer.rb - About 35 mins to fix

          Method levenshtein_distance has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def levenshtein_distance(this, that, ins = 2, del = 2, sub = 1)
          Severity: Minor
          Found in lib/bundler/similarity_detector.rb - About 35 mins to fix

            Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    def initialize(path, uri, ref, revision = nil, git = nil)
            Severity: Minor
            Found in lib/bundler/source/git/git_proxy.rb - About 35 mins to fix

              Method print_command has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def print_command
                    return unless Bundler.ui.debug?
                    cmd = current_command
                    command_name = cmd.name
                    return if PARSEABLE_COMMANDS.include?(command_name)
              Severity: Minor
              Found in lib/bundler/cli.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 build_extensions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def build_extensions
                    extension_cache_path = options[:bundler_extension_cache_path]
                    return super unless extension_cache_path && extension_dir = Bundler.rubygems.spec_extension_dir(spec)
              
                    extension_dir = Pathname.new(extension_dir)
              Severity: Minor
              Found in lib/bundler/rubygems_gem_installer.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 validate_keys has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def validate_keys(command, opts, valid_keys)
                    invalid_keys = opts.keys - valid_keys
              
                    git_source = opts.keys & @git_sources.keys.map(&:to_s)
                    if opts["branch"] && !(opts["git"] || opts["github"] || git_source.any?)
              Severity: Minor
              Found in lib/bundler/dsl.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 converge_locals has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def converge_locals
                    locals = []
              
                    Bundler.settings.local_overrides.map do |k, v|
                      spec   = @dependencies.find {|s| s.name == k }
              Severity: Minor
              Found in lib/bundler/definition.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 to_s has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                    def to_s
                      at = if local?
                        path
                      elsif user_ref = options["ref"]
                        if ref =~ /\A[a-z0-9]{4,}\z/i
              Severity: Minor
              Found in lib/bundler/source/git.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 check_primary_source_safety has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def check_primary_source_safety(source_list)
                    return if source_list.rubygems_primary_remotes.empty? && source_list.global_rubygems_source.nil?
              
                    if Bundler.feature_flag.disable_multisource?
                      msg = "This Gemfile contains multiple primary sources. " \
              Severity: Minor
              Found in lib/bundler/dsl.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 call has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                      def call(path, headers)
                        fetcher.downloader.fetch(fetcher.fetch_uri + path, headers)
                      rescue NetworkDownError => e
                        raise unless Bundler.feature_flag.allow_offline_install? && headers["If-None-Match"]
                        ui.warn "Using the cached data for the new index because of a network error: #{e}"
              Severity: Minor
              Found in lib/bundler/fetcher/compact_index.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 check_for_activated_spec! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def check_for_activated_spec!(spec)
                    return unless activated_spec = Bundler.rubygems.loaded_specs(spec.name)
                    return if activated_spec.version == spec.version
              
                    suggestion = if Bundler.rubygems.spec_default_gem?(activated_spec)
              Severity: Minor
              Found in lib/bundler/runtime.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 source_requirements has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def source_requirements
                    # Load all specs from remote sources
                    index
              
                    # Record the specs available in each gem's source, so that those
              Severity: Minor
              Found in lib/bundler/definition.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 specs_for_names has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                    def specs_for_names(gem_names)
                      gem_info = []
                      complete_gems = []
                      remaining_gems = gem_names.dup
              
              
              Severity: Minor
              Found in lib/bundler/fetcher/compact_index.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 restore has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def restore
                    env = @original.clone
                    @keys.each do |key|
                      value_original = env[@prefix + key]
                      next if value_original.nil? || value_original.empty?
              Severity: Minor
              Found in lib/bundler/environment_preserver.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

              Severity
              Category
              Status
              Source
              Language