Restream/redmine_undev_git

View on GitHub
lib/redmine/scm/adapters/undev_git_adapter.rb

Summary

Maintainability
F
5 days
Test Coverage

Method revisions_in_chunks has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
Open

    def revisions_in_chunks(path, identifier_from, identifier_to, options = {}, &block)

      revision_regexp = %r{
            (?<h>[0-9a-f]{40});\s
            (?<ai>.*);\s
Severity: Minor
Found in lib/redmine/scm/adapters/undev_git_adapter.rb - About 1 day 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 entries has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
Open

    def entries(path, identifier = nil, options = {})
      path     ||= ''
      p        = scm_iconv(path_encoding, 'UTF-8', path)
      entries  = Entries.new
      cmd_args = %w{ls-tree -l}
Severity: Minor
Found in lib/redmine/scm/adapters/undev_git_adapter.rb - About 7 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

File undev_git_adapter.rb has 417 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require_dependency 'redmine/scm/adapters/git_adapter'
require_dependency 'redmine/scm/adapters/undev_git_revision'

module Redmine::Scm::Adapters
  class UndevGitAdapter < AbstractAdapter
Severity: Minor
Found in lib/redmine/scm/adapters/undev_git_adapter.rb - About 6 hrs to fix

    Class UndevGitAdapter has 29 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class UndevGitAdapter < AbstractAdapter
    
        include RedmineUndevGit::Includes::GitShell
    
        # Git executable name
    Severity: Minor
    Found in lib/redmine/scm/adapters/undev_git_adapter.rb - About 3 hrs to fix

      Method revisions_in_chunks has 71 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def revisions_in_chunks(path, identifier_from, identifier_to, options = {}, &block)
      
            revision_regexp = %r{
                  (?<h>[0-9a-f]{40});\s
                  (?<ai>.*);\s
      Severity: Major
      Found in lib/redmine/scm/adapters/undev_git_adapter.rb - About 2 hrs to fix

        Method revisions has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            def revisions(path, identifier_from, identifier_to, options = {}, &block)
              if block_given?
                raise 'Can' 't read chunks with reverse option' if options[:reverse]
                revisions_in_chunks(path, identifier_from, identifier_to, options, &block)
              else
        Severity: Minor
        Found in lib/redmine/scm/adapters/undev_git_adapter.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 chunked_git_log has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            def chunked_git_log(path, options, &block)
              skip = 0
        
              revisions = revisions_for_git_cmd(options)
        
        
        Severity: Minor
        Found in lib/redmine/scm/adapters/undev_git_adapter.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 revisions_for_git_cmd has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            def revisions_for_git_cmd(options = {})
              revisions                      = []
              identifier_from, identifier_to = options[:identifier_from], options[:identifier_to]
              if identifier_from || identifier_to
                revisions << ''
        Severity: Minor
        Found in lib/redmine/scm/adapters/undev_git_adapter.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 entries has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def entries(path, identifier = nil, options = {})
              path     ||= ''
              p        = scm_iconv(path_encoding, 'UTF-8', path)
              entries  = Entries.new
              cmd_args = %w{ls-tree -l}
        Severity: Minor
        Found in lib/redmine/scm/adapters/undev_git_adapter.rb - About 1 hr to fix

          Method chunked_git_log has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def chunked_git_log(path, options, &block)
                skip = 0
          
                revisions = revisions_for_git_cmd(options)
          
          
          Severity: Minor
          Found in lib/redmine/scm/adapters/undev_git_adapter.rb - About 1 hr to fix

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

                def lastrev(path, rev)
                  return nil if path.nil?
                  cmd_args = %w{log --no-color --encoding=UTF-8 --date=iso --pretty=fuller --no-merges -n 1}
                  cmd_args << rev if rev
                  cmd_args << '--' << path unless path.empty?
            Severity: Minor
            Found in lib/redmine/scm/adapters/undev_git_adapter.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 annotate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                def annotate(path, identifier = nil)
                  identifier = 'HEAD' if identifier.blank?
                  cmd_args   = %w{blame --encoding=UTF-8}
                  cmd_args << '-p' << identifier << '--' << scm_iconv(path_encoding, 'UTF-8', path)
                  blame   = Annotate.new
            Severity: Minor
            Found in lib/redmine/scm/adapters/undev_git_adapter.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 annotate has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def annotate(path, identifier = nil)
                  identifier = 'HEAD' if identifier.blank?
                  cmd_args   = %w{blame --encoding=UTF-8}
                  cmd_args << '-p' << identifier << '--' << scm_iconv(path_encoding, 'UTF-8', path)
                  blame   = Annotate.new
            Severity: Minor
            Found in lib/redmine/scm/adapters/undev_git_adapter.rb - About 1 hr to fix

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

                  def diff(path, identifier_from, identifier_to = nil)
                    path     ||= ''
                    cmd_args = []
                    if identifier_to
                      cmd_args << 'diff' << '--no-color' << identifier_to << identifier_from
              Severity: Minor
              Found in lib/redmine/scm/adapters/undev_git_adapter.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 initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def initialize(url, root_url, login=nil, password=nil, path_encoding=nil)
              Severity: Minor
              Found in lib/redmine/scm/adapters/undev_git_adapter.rb - About 35 mins to fix

                Method revisions has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def revisions(path, identifier_from, identifier_to, options = {}, &block)
                Severity: Minor
                Found in lib/redmine/scm/adapters/undev_git_adapter.rb - About 35 mins to fix

                  Method revisions_in_chunks has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def revisions_in_chunks(path, identifier_from, identifier_to, options = {}, &block)
                  Severity: Minor
                  Found in lib/redmine/scm/adapters/undev_git_adapter.rb - About 35 mins to fix

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

                        def cloned?
                          return false unless Dir.exist?(root_url)
                    
                          args = ['--git-dir', root_url, 'rev-parse']
                          args = args.map { |arg| shell_quote(arg.to_s) }.join(' ')
                    Severity: Minor
                    Found in lib/redmine/scm/adapters/undev_git_adapter.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 entry has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def entry(path = nil, identifier = nil)
                          parts       = path.to_s.split(%r{[\/\\]}).select { |n| !n.blank? }
                          search_path = parts[0..-2].join('/')
                          search_name = parts[-1]
                          if search_path.blank? && search_name.blank?
                    Severity: Minor
                    Found in lib/redmine/scm/adapters/undev_git_adapter.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