bundler/bundler

View on GitHub
lib/bundler/cli.rb

Summary

Maintainability
F
3 days
Test Coverage

File cli.rb has 713 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require_relative "vendored_thor"

module Bundler
  class CLI < Thor
    require_relative "cli/common"
Severity: Major
Found in lib/bundler/cli.rb - About 1 day to fix

    Class CLI has 43 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class CLI < Thor
        require_relative "cli/common"
    
        package_name "Bundler"
    
    
    Severity: Minor
    Found in lib/bundler/cli.rb - About 5 hrs to fix

      Method show has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

            def show(gem_name = nil)
              if ARGV[0] == "show"
                rest = ARGV[1..-1]
      
                if flag = rest.find{|arg| ["--verbose", "--outdated"].include?(arg) }
      Severity: Minor
      Found in lib/bundler/cli.rb - About 3 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 warn_on_outdated_bundler has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

          def warn_on_outdated_bundler
            return if Bundler.settings[:disable_version_check]
      
            command_name = current_command.name
            return if PARSEABLE_COMMANDS.include?(command_name)
      Severity: Minor
      Found in lib/bundler/cli.rb - About 3 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 initialize has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def initialize(*args)
            super
      
            custom_gemfile = options[:gemfile] || Bundler.settings[:gemfile]
            if custom_gemfile && !custom_gemfile.empty?
      Severity: Minor
      Found in lib/bundler/cli.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 reformatted_help_args has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def self.reformatted_help_args(args)
            bundler_commands = (COMMAND_ALIASES.keys + COMMAND_ALIASES.values).flatten
      
            help_flags = %w[--help -h]
            exec_commands = ["exec"] + COMMAND_ALIASES["exec"]
      Severity: Minor
      Found in lib/bundler/cli.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 help has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def help(cli = nil)
            case cli
            when "gemfile" then command = "gemfile"
            when nil       then command = "bundle"
            else command = "bundle-#{cli}"
      Severity: Minor
      Found in lib/bundler/cli.rb - About 45 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_command has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def print_command
            return unless Bundler.ui.debug?
            cmd = current_command
            command_name = cmd.name
            return if PARSEABLE_COMMANDS.include?(command_name)
      Severity: Minor
      Found in lib/bundler/cli.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

      Avoid too many return statements within this method.
      Open

            return if current >= latest
      Severity: Major
      Found in lib/bundler/cli.rb - About 30 mins to fix

        There are no issues that match your filters.

        Category
        Status