zedtux/ruby-git-ce

View on GitHub
lib/git/lib.rb

Summary

Maintainability
F
5 days
Test Coverage

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

  class Lib

    @@semaphore = Mutex.new

    def initialize(base = nil, logger = nil)
Severity: Major
Found in lib/git/lib.rb - About 1 day to fix

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

    require 'tempfile'
    
    module Git
    
      class GitExecuteError < StandardError
    Severity: Major
    Found in lib/git/lib.rb - About 1 day to fix

      Method clone has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          def clone(repository, name, opts = {})
            @path = opts[:path] || '.'
            clone_dir = opts[:path] ? File.join(@path, name) : name
      
            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 describe has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def describe(committish=nil, opts={})
            arr_opts = []
      
            arr_opts << '--all' if opts[:all]
            arr_opts << '--tags' if opts[:tags]
      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 process_commit_log_data has a Cognitive Complexity of 12 (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 process_commit_log_data has 27 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 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def ls_remote(location = nil, ref = nil)
              location ||= '.'
              Hash.new{ |h,k| h[k] = {} }.tap do |hsh|
                command_lines('ls-remote', [location, ref].compact, false).each do |line|
                  (sha, info) = line.split("\t")
        Severity: Minor
        Found in lib/git/lib.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 archive has a Cognitive Complexity of 9 (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 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 push has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def push(remote, branch = 'master', opts = {})
              # Small hack to keep backwards compatibility with the 'push(remote, branch, tags)' method signature.
              opts = {:tags => opts} if [true, false].include?(opts)
        
              arr_opts = []
        Severity: Minor
        Found in lib/git/lib.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 grep has a Cognitive Complexity of 8 (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 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 command has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def command(cmd, opts = [], chdir = true, redirect = '', &block)
        Severity: Minor
        Found in lib/git/lib.rb - About 35 mins to fix

          Method log_common_options has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def log_common_options(opts)
                arr_opts = []
          
                arr_opts << "-#{opts[:count]}" if opts[:count]
                arr_opts << "--no-color"
          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 commit has a Cognitive Complexity of 7 (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 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 6 (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 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 process_commit_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def process_commit_data(data, sha = nil, indent = 4)
                hsh = {
                  'sha'     => sha,
                  'message' => '',
                  'parent'  => []
          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 command has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def command(cmd, opts = [], chdir = true, redirect = '', &block)
                global_opts = []
                global_opts << "--git-dir=#{@git_dir}" if !@git_dir.nil?
                global_opts << "--work-tree=#{@git_work_dir}" if !@git_work_dir.nil?
          
          
          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

          There are no issues that match your filters.

          Category
          Status