bundler/bundler

View on GitHub
lib/bundler/settings.rb

Summary

Maintainability
D
1 day
Test Coverage

Class Settings has 40 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Settings
    autoload :Mirror,  File.expand_path("mirror", __dir__)
    autoload :Mirrors, File.expand_path("mirror", __dir__)
    autoload :Validator, File.expand_path("settings/validator", __dir__)

Severity: Minor
Found in lib/bundler/settings.rb - About 5 hrs to fix

    File settings.rb has 364 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module Bundler
      class Settings
        autoload :Mirror,  File.expand_path("mirror", __dir__)
        autoload :Mirrors, File.expand_path("mirror", __dir__)
        autoload :Validator, File.expand_path("settings/validator", __dir__)
    Severity: Minor
    Found in lib/bundler/settings.rb - About 4 hrs to fix

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

            def validate!
              return unless explicit_path && system_path
              path = Bundler.settings.pretty_values_for(:path)
              path.unshift(nil, "path:") unless path.empty?
              system_path = Bundler.settings.pretty_values_for("path.system")
      Severity: Minor
      Found in lib/bundler/settings.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 base_path_relative_to_pwd has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

            def base_path_relative_to_pwd
              base_path = Pathname.new(self.base_path)
              expanded_base_path = base_path.expand_path(Bundler.root)
              relative_path = expanded_base_path.relative_path_from(Pathname.pwd)
              if relative_path.to_s.start_with?("..")
      Severity: Minor
      Found in lib/bundler/settings.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 load_config has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def load_config(config_file)
            return {} if !config_file || ignore_config?
            SharedHelpers.filesystem_access(config_file, :read) do |file|
              valid_file = file.exist? && !file.size.zero?
              return {} unless valid_file
      Severity: Minor
      Found in lib/bundler/settings.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 converted_value has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def converted_value(value, key)
            if is_array(key)
              to_array(value)
            elsif value.nil?
              nil
      Severity: Minor
      Found in lib/bundler/settings.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

      TODO found
      Open

          # TODO: duplicates Rubygems#normalize_uri
      Severity: Minor
      Found in lib/bundler/settings.rb by fixme

      TODO found
      Open

          # TODO: is this the correct place to validate mirror URIs?
      Severity: Minor
      Found in lib/bundler/settings.rb by fixme

      There are no issues that match your filters.

      Category
      Status