bundler/bundler

View on GitHub
lib/bundler/runtime.rb

Summary

Maintainability
D
1 day
Test Coverage

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

    def require(*groups)
      groups.map!(&:to_sym)
      groups = [:default] if groups.empty?

      @definition.dependencies.each do |dep|
Severity: Minor
Found in lib/bundler/runtime.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

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 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 require has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def require(*groups)
          groups.map!(&:to_sym)
          groups = [:default] if groups.empty?
    
          @definition.dependencies.each do |dep|
    Severity: Minor
    Found in lib/bundler/runtime.rb - About 1 hr to fix

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

          def setup(*groups)
            @definition.ensure_equivalent_gemfile_and_lockfile if Bundler.frozen_bundle?
      
            groups.map!(&:to_sym)
      
      
      Severity: Minor
      Found in lib/bundler/runtime.rb - About 25 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

      There are no issues that match your filters.

      Category
      Status