bundler/bundler

View on GitHub
lib/bundler/shared_helpers.rb

Summary

Maintainability
B
5 hrs
Test Coverage

File shared_helpers.rb has 270 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "pathname"
require "rbconfig"

require_relative "version"
require_relative "constants"
Severity: Minor
Found in lib/bundler/shared_helpers.rb - About 2 hrs to fix

    Method search_up has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def search_up(*names)
          previous = nil
          current  = File.expand_path(SharedHelpers.pwd).tap{|x| x.untaint if RUBY_VERSION < "2.7" }
    
          until !File.directory?(current) || current == previous
    Severity: Minor
    Found in lib/bundler/shared_helpers.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 pretty_dependency has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def pretty_dependency(dep, print_source = false)
          msg = String.new(dep.name)
          msg << " (#{dep.requirement})" unless dep.requirement == Gem::Requirement.default
    
          if dep.is_a?(Bundler::Dependency)
    Severity: Minor
    Found in lib/bundler/shared_helpers.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 print_major_deprecations! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def print_major_deprecations!
          multiple_gemfiles = search_up(".") do |dir|
            gemfiles = gemfile_names.select {|gf| File.file? File.expand_path(gf, dir) }
            next if gemfiles.empty?
            break gemfiles.size != 1
    Severity: Minor
    Found in lib/bundler/shared_helpers.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