bundler/bundler

View on GitHub
lib/bundler/spec_set.rb

Summary

Maintainability
C
1 day
Test Coverage

Method for has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

    def for(dependencies, skip = [], check = false, match_current_platform = false, raise_on_missing = true)
      handled = Set.new
      deps = dependencies.dup
      specs = []
      skip += ["bundler"]
Severity: Minor
Found in lib/bundler/spec_set.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 SpecSet has 24 methods (exceeds 20 allowed). Consider refactoring.
Open

  class SpecSet
    include Enumerable
    include TSort

    def initialize(specs)
Severity: Minor
Found in lib/bundler/spec_set.rb - About 2 hrs 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 for has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def for(dependencies, skip = [], check = false, match_current_platform = false, raise_on_missing = true)
          handled = Set.new
          deps = dependencies.dup
          specs = []
          skip += ["bundler"]
    Severity: Minor
    Found in lib/bundler/spec_set.rb - About 1 hr to fix

      Method materialized_for_all_platforms has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def materialized_for_all_platforms
            names = @specs.map(&:name).uniq
            @specs.map do |s|
              next s unless s.is_a?(LazySpecification)
              s.source.dependency_names = names if s.source.respond_to?(:dependency_names=)
      Severity: Minor
      Found in lib/bundler/spec_set.rb - About 55 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

        There are no issues that match your filters.

        Category
        Status