schacon/ruby-git

View on GitHub

Showing 34 of 34 total issues

File lib.rb has 925 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'git/command_line'
require 'git/errors'
require 'logger'
require 'pp'
require 'process_executer'
Severity: Major
Found in lib/git/lib.rb - About 2 days to fix

    Class Lib has 108 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class Lib
        # The path to the Git working copy.  The default is '"./.git"'.
        #
        # @return [Pathname] the path to the Git working copy.
        #
    Severity: Major
    Found in lib/git/lib.rb - About 2 days to fix

      Class Base has 86 methods (exceeds 20 allowed). Consider refactoring.
      Open

        class Base
          # (see Git.bare)
          def self.bare(git_dir, options = {})
            normalize_paths(options, default_repository: git_dir, bare: true)
            self.new(options)
      Severity: Major
      Found in lib/git/base.rb - About 1 day to fix

        File base.rb has 383 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require 'logger'
        require 'open3'
        
        module Git
          # The main public interface for interacting with Git commands
        Severity: Minor
        Found in lib/git/base.rb - About 5 hrs to fix

          Class Status has 24 methods (exceeds 20 allowed). Consider refactoring.
          Open

            class Status
              include Enumerable
          
              def initialize(base)
                @base = base
          Severity: Minor
          Found in lib/git/status.rb - About 2 hrs to fix

            Method push has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

                def push(remote = nil, branch = nil, opts = nil)
                  if opts.nil? && branch.instance_of?(Hash)
                    opts = branch
                    branch = nil
                  end
            Severity: Minor
            Found in lib/git/lib.rb - About 2 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

            Class Log has 21 methods (exceeds 20 allowed). Consider refactoring.
            Open

              class Log
                include Enumerable
            
                # Create a new Git::Log object
                #
            Severity: Minor
            Found in lib/git/log.rb - About 2 hrs to fix

              Method commit has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

                  def commit(message, opts = {})
                    arr_opts = []
                    arr_opts << "--message=#{message}" if message
                    arr_opts << '--amend' << '--no-edit' if opts[:amend]
                    arr_opts << '--all' if opts[:add_all] || opts[:all]
              Severity: Minor
              Found in lib/git/lib.rb - About 2 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 process_full_diff has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

                    def process_full_diff
                      defaults = {
                        :mode => '',
                        :src => '',
                        :dst => '',
              Severity: Minor
              Found in lib/git/diff.rb - About 2 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 process_commit_log_data has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

                  def process_commit_log_data(data)
                    in_message = false
              
                    hsh_array = []
              
              
              Severity: Minor
              Found in lib/git/lib.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 grep has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

                  def grep(string, opts = {})
                    opts[:object] ||= 'HEAD'
              
                    grep_opts = ['-n']
                    grep_opts << '-i' if opts[:ignore_case]
              Severity: Minor
              Found in lib/git/lib.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 describe has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  def describe(commit_ish = nil, opts = {})
                    assert_args_are_not_options('commit-ish object', commit_ish)
              
                    arr_opts = []
              
              
              Severity: Minor
              Found in lib/git/lib.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 tag has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  def tag(name, *opts)
                    target = opts[0].instance_of?(String) ? opts[0] : nil
              
                    opts = opts.last.instance_of?(Hash) ? opts.last : {}
              
              
              Severity: Minor
              Found in lib/git/lib.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 clone has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  def clone(repository_url, directory, opts = {})
                    @path = opts[:path] || '.'
                    clone_dir = opts[:path] ? File.join(@path, directory) : directory
              
                    arr_opts = []
              Severity: Minor
              Found in lib/git/lib.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 fetch has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  def fetch(remote, opts)
                    arr_opts = []
                    arr_opts << '--all' if opts[:all]
                    arr_opts << '--tags' if opts[:t] || opts[:tags]
                    arr_opts << '--prune' if opts[:p] || opts[:prune]
              Severity: Minor
              Found in lib/git/lib.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 process_full_diff has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def process_full_diff
                      defaults = {
                        :mode => '',
                        :src => '',
                        :dst => '',
              Severity: Minor
              Found in lib/git/diff.rb - About 1 hr to fix

                Method process_commit_log_data has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def process_commit_log_data(data)
                      in_message = false
                
                      hsh_array = []
                
                
                Severity: Minor
                Found in lib/git/lib.rb - About 1 hr to fix

                  Method ls_remote has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def ls_remote(location=nil, opts={})
                        arr_opts = []
                        arr_opts << '--refs' if opts[:refs]
                        arr_opts << (location || '.')
                  
                  
                  Severity: Minor
                  Found in lib/git/lib.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 initialize has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def initialize(options = {})
                        if working_dir = options[:working_directory]
                          options[:repository] ||= File.join(working_dir, '.git')
                          options[:index] ||= File.join(options[:repository], 'index')
                        end
                  Severity: Minor
                  Found in lib/git/base.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 log_common_options has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def log_common_options(opts)
                        arr_opts = []
                  
                        if opts[:count] && !opts[:count].is_a?(Integer)
                          raise ArgumentError, "The log count option must be an Integer but was #{opts[:count].inspect}"
                  Severity: Minor
                  Found in lib/git/lib.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

                  Severity
                  Category
                  Status
                  Source
                  Language