bundler/bundler

View on GitHub
lib/bundler/resolver.rb

Summary

Maintainability
F
3 days
Test Coverage

Method version_conflict_message has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

    def version_conflict_message(e)
      # only show essential conflicts, if possible
      conflicts = e.conflicts.dup
      conflicts.delete_if do |_name, conflict|
        deps = conflict.requirement_trees.map(&:last).flatten(1)
Severity: Minor
Found in lib/bundler/resolver.rb - About 5 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 363 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Bundler
  class Resolver
    require_relative "vendored_molinillo"
    require_relative "resolver/spec_group"

Severity: Minor
Found in lib/bundler/resolver.rb - About 4 hrs to fix

    Method version_conflict_message has 75 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def version_conflict_message(e)
          # only show essential conflicts, if possible
          conflicts = e.conflicts.dup
          conflicts.delete_if do |_name, conflict|
            deps = conflict.requirement_trees.map(&:last).flatten(1)
    Severity: Major
    Found in lib/bundler/resolver.rb - About 3 hrs to fix

      Method verify_gemfile_dependencies_are_found! has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          def verify_gemfile_dependencies_are_found!(requirements)
            requirements.each do |requirement|
              name = requirement.name
              next if name == "bundler"
              next unless search_for(requirement).empty?
      Severity: Minor
      Found in lib/bundler/resolver.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

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

        class Resolver
          require_relative "vendored_molinillo"
          require_relative "resolver/spec_group"
      
          # Figures out the best possible configuration of gems that satisfies
      Severity: Minor
      Found in lib/bundler/resolver.rb - About 2 hrs to fix

        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 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 validate_resolved_specs! has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              def validate_resolved_specs!(resolved_specs)
                resolved_specs.each do |v|
                  name = v.name
                  next unless sources = relevant_sources_for_vertex(v)
                  sources.compact!
          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 search_for has a Cognitive Complexity of 13 (exceeds 5 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: 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 index_for has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              def index_for(dependency)
                source = @source_requirements[dependency.name]
                if source
                  source.specs
                elsif @lockfile_uses_separate_rubygems_sources
          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 verify_gemfile_dependencies_are_found! has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def verify_gemfile_dependencies_are_found!(requirements)
                requirements.each do |requirement|
                  name = requirement.name
                  next if name == "bundler"
                  next unless search_for(requirement).empty?
          Severity: Minor
          Found in lib/bundler/resolver.rb - About 1 hr to fix

            Method resolve has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def self.resolve(requirements, index, source_requirements = {}, base = [], gem_version_promoter = GemVersionPromoter.new, additional_base_requirements = [], platforms = nil)
            Severity: Major
            Found in lib/bundler/resolver.rb - About 50 mins to fix

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

                  def initialize(index, source_requirements, base, gem_version_promoter, additional_base_requirements, platforms)
              Severity: Minor
              Found in lib/bundler/resolver.rb - About 45 mins to fix

                There are no issues that match your filters.

                Category
                Status