bundler/bundler

View on GitHub
lib/bundler/source/rubygems.rb

Summary

Maintainability
F
3 days
Test Coverage

Class Rubygems has 45 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Rubygems < Source
      autoload :Remote, File.expand_path("rubygems/remote", __dir__)

      # Use the API when installing less than X gems
      API_REQUEST_LIMIT = 500
Severity: Minor
Found in lib/bundler/source/rubygems.rb - About 6 hrs to fix

    Method install has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
    Open

          def install(spec, opts = {})
            force = opts[:force]
            ensure_builtin_gems_cached = opts[:ensure_builtin_gems_cached]
    
            if ensure_builtin_gems_cached && builtin_gem?(spec)
    Severity: Minor
    Found in lib/bundler/source/rubygems.rb - About 6 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 rubygems.rb has 413 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require "rubygems/user_interaction"
    
    module Bundler
      class Source
        class Rubygems < Source
    Severity: Minor
    Found in lib/bundler/source/rubygems.rb - About 5 hrs to fix

      Method install has 84 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def install(spec, opts = {})
              force = opts[:force]
              ensure_builtin_gems_cached = opts[:ensure_builtin_gems_cached]
      
              if ensure_builtin_gems_cached && builtin_gem?(spec)
      Severity: Major
      Found in lib/bundler/source/rubygems.rb - About 3 hrs to fix

        Method double_check_for has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

              def double_check_for(unmet_dependency_names)
                return unless @allow_remote
                return unless api_fetchers.any?
        
                unmet_dependency_names = unmet_dependency_names.call
        Severity: Minor
        Found in lib/bundler/source/rubygems.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 cache has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

              def cache(spec, custom_path = nil)
                if builtin_gem?(spec)
                  cached_path = cached_built_in_gem(spec)
                else
                  cached_path = cached_gem(spec)
        Severity: Minor
        Found in lib/bundler/source/rubygems.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 fetch_names has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

              def fetch_names(fetchers, dependency_names, index, override_dupes)
                fetchers.each do |f|
                  if dependency_names
                    Bundler.ui.info "Fetching gem metadata from #{f.uri}", Bundler.ui.debug?
                    index.use f.specs_with_retry(dependency_names, self), override_dupes
        Severity: Minor
        Found in lib/bundler/source/rubygems.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 download_cache_path has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

              def download_cache_path(spec)
                return unless Bundler.feature_flag.global_gem_cache?
                return unless remote = spec.remote
                return unless cache_slug = remote.cache_slug
        
        
        Severity: Minor
        Found in lib/bundler/source/rubygems.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

        Method fetch_gem has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

              def fetch_gem(spec)
                return false unless spec.remote
        
                spec.fetch_platform
        
        
        Severity: Minor
        Found in lib/bundler/source/rubygems.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