rubygems/rubygems

View on GitHub
bundler/lib/bundler/source/git/git_proxy.rb

Summary

Maintainability
D
2 days
Test Coverage

Class GitProxy has 47 methods (exceeds 20 allowed). Consider refactoring.
Open

      class GitProxy
        attr_accessor :path, :uri, :branch, :tag, :ref, :explicit_ref
        attr_writer :revision

        def initialize(path, uri, options = {}, revision = nil, git = nil)
Severity: Minor
Found in bundler/lib/bundler/source/git/git_proxy.rb - About 6 hrs to fix

    File git_proxy.rb has 361 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module Bundler
      class Source
        class Git
          class GitNotInstalledError < GitError
            def initialize
    Severity: Minor
    Found in bundler/lib/bundler/source/git/git_proxy.rb - About 4 hrs to fix

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

              def copy_to(destination, submodules = false)
                unless File.exist?(destination.join(".git"))
                  begin
                    SharedHelpers.filesystem_access(destination.dirname) do |p|
                      FileUtils.mkdir_p(p)
      Severity: Minor
      Found in bundler/lib/bundler/source/git/git_proxy.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 copy_to has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def copy_to(destination, submodules = false)
                unless File.exist?(destination.join(".git"))
                  begin
                    SharedHelpers.filesystem_access(destination.dirname) do |p|
                      FileUtils.mkdir_p(p)
      Severity: Minor
      Found in bundler/lib/bundler/source/git/git_proxy.rb - About 1 hr to fix

        Method clone_needs_extra_fetch? has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

                def clone_needs_extra_fetch?
                  return true if path.exist?
        
                  SharedHelpers.filesystem_access(path.dirname) do |p|
                    FileUtils.mkdir_p(p)
        Severity: Minor
        Found in bundler/lib/bundler/source/git/git_proxy.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 initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                def initialize(path, uri, options = {}, revision = nil, git = nil)
        Severity: Minor
        Found in bundler/lib/bundler/source/git/git_proxy.rb - About 35 mins to fix

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

                  def initialize(path, uri, options = {}, revision = nil, git = nil)
                    @path     = path
                    @uri      = uri
                    @tag      = options["tag"]
                    @branch   = options["branch"]
          Severity: Minor
          Found in bundler/lib/bundler/source/git/git_proxy.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 git_remote_fetch has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                  def git_remote_fetch(args)
                    command = ["fetch", "--force", "--quiet", "--no-tags", *args, "--", configured_uri, refspec].compact
                    command_with_no_credentials = check_allowed(command)
          
                    Bundler::Retry.new("`#{command_with_no_credentials}` at #{path}", [MissingGitRevisionError]).attempts do
          Severity: Minor
          Found in bundler/lib/bundler/source/git/git_proxy.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 checkout has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                  def checkout
                    return if has_revision_cached?
          
                    Bundler.ui.info "Fetching #{credential_filtered_uri}"
          
          
          Severity: Minor
          Found in bundler/lib/bundler/source/git/git_proxy.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