schacon/ruby-git

View on GitHub

Showing 34 of 34 total issues

Method archive has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def archive(sha, file = nil, opts = {})
      opts[:format] ||= 'zip'

      if opts[:format] == 'tgz'
        opts[:format] = 'tar'
Severity: Minor
Found in lib/git/lib.rb - About 1 hr to fix

    Method push has 26 lines of code (exceeds 25 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 1 hr to fix

      Method process_result has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def process_result(git_cmd, status, out, err, normalize, chomp, timeout)
      Severity: Major
      Found in lib/git/command_line.rb - About 50 mins to fix

        Method archive has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def archive(sha, file = nil, opts = {})
              opts[:format] ||= 'zip'
        
              if opts[:format] == 'tgz'
                opts[:format] = 'tar'
        Severity: Minor
        Found in lib/git/lib.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 checkout has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def checkout(branch = nil, opts = {})
              if branch.is_a?(Hash) && opts == {}
                opts = branch
                branch = nil
              end
        Severity: Minor
        Found in lib/git/lib.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 process_result has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def process_result(git_cmd, status, out, err, normalize, chomp, timeout)
              out_str, err_str = post_process_all([out, err], normalize, chomp)
              logger.info { "#{git_cmd} exited with status #{status}" }
              logger.debug { "stdout:\n#{out_str.inspect}\nstderr:\n#{err_str.inspect}" }
              Git::CommandLineResult.new(git_cmd, status, out_str, err_str).tap do |result|
        Severity: Minor
        Found in lib/git/command_line.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 clone_to has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def self.clone_to(url, bare: false, mirror: false)
              uri = parse(url)
              path_parts = uri.path.split('/')
              path_parts.pop if path_parts.last == '.git'
              directory = path_parts.last
        Severity: Minor
        Found in lib/git/url.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 branches_all has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def branches_all
              command_lines('branch', '-a').map do |line|
                match_data = line.match(BRANCH_LINE_REGEXP)
                raise Git::UnexpectedResultError, 'Unexpected branch line format' unless match_data
                next nil if match_data[:not_a_branch] || match_data[:detached_ref]
        Severity: Minor
        Found in lib/git/lib.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 initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def initialize(base = nil, logger = nil)
              @git_dir = nil
              @git_index_file = nil
              @git_work_dir = nil
              @path = nil
        Severity: Minor
        Found in lib/git/lib.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 merge_base has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def merge_base(*args)
              opts = args.last.is_a?(Hash) ? args.pop : {}
        
              arg_opts = []
        
        
        Severity: Minor
        Found in lib/git/lib.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 tag_sha has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def tag_sha(tag_name)
              head = File.join(@git_dir, 'refs', 'tags', tag_name)
              return File.read(head).chomp if File.exist?(head)
        
              begin
        Severity: Minor
        Found in lib/git/lib.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 post_process has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def post_process(writer, normalize, chomp)
              if writer.respond_to?(:string)
                output = writer.string.dup
                output = output.lines.map { |l| Git::EncodingUtils.normalize_encoding(l) }.join if normalize
                output.chomp! if chomp
        Severity: Minor
        Found in lib/git/command_line.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 current_branch_state has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def current_branch_state
              branch_name = command('branch', '--show-current')
              return HeadState.new(:detached, 'HEAD') if branch_name.empty?
        
              state =
        Severity: Minor
        Found in lib/git/lib.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 fetch_added has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def fetch_added
              unless @base.lib.empty?
              # Files changed between the repo HEAD vs. the worktree
              # git diff-index HEAD
              # { file => { path: file, type: 'M', mode_index: '100644', mode_repo: '100644', sha_index: '0000000', :sha_repo: '52c6c4e' } }
        Severity: Minor
        Found in lib/git/status.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

        Severity
        Category
        Status
        Source
        Language