hannesg/multi_git

View on GitHub

Showing 36 of 36 total issues

Method traverse has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

      def traverse(path, options = {})
        unless path.kind_of? String
          raise ArgumentError, "Expected a String, got #{path.inspect}"
        end
        parts = path.split('/').reverse!
Severity: Minor
Found in lib/multi_git/tree.rb - About 5 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 ref.rb has 269 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'multi_git/utils'
require 'fileutils'
module MultiGit

  # A reference is something that points eihter to another reference or to 
Severity: Minor
Found in lib/multi_git/ref.rb - About 2 hrs to fix

    Method initialize_options has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

      def initialize_options(path, options)
        options = options.dup
        options[:expected_bare] = options[:bare]
        looks_bare = Utils.looks_bare?(path)
        case(options[:bare])
    Severity: Minor
    Found in lib/multi_git/repository.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 read! has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

          def read!
            begin
              content = IO.read(::File.join(repository.git_dir,name))
              if content =~ SYMBOLIC_REF_LINE
                @target = repository.ref($1)
    Severity: Minor
    Found in lib/multi_git/git_backend/ref.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 traverse has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def traverse(path, options = {})
            unless path.kind_of? String
              raise ArgumentError, "Expected a String, got #{path.inspect}"
            end
            parts = path.split('/').reverse!
    Severity: Minor
    Found in lib/multi_git/tree.rb - About 1 hr to fix

      Method traverse_set has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

            def traverse_set(current, parts, value, create)
              if parts.none?
                raise
              end
              if parts.size == 1
      Severity: Minor
      Found in lib/multi_git/tree/builder.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 write has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def write(content, type = :blob)
            if content.kind_of? MultiGit::Builder
              return content >> self
            end
            validate_type(type)
      Severity: Minor
      Found in lib/multi_git/jgit_backend/repository.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 set has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

            def set(key, *args, &block)
              options = {}
              case(args.size)
              when 0
                raise ArgumentError, "Expected a value or a block" unless block
      Severity: Minor
      Found in lib/multi_git/tree/builder.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_options has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def initialize_options(path, options)
          options = options.dup
          options[:expected_bare] = options[:bare]
          looks_bare = Utils.looks_bare?(path)
          case(options[:bare])
      Severity: Minor
      Found in lib/multi_git/repository.rb - About 1 hr to fix

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

            def each_branch(filter = :all)
              return to_enum(:each_branch, filter) unless block_given?
              prefix = case filter
                   when :all, Regexp then 'refs/'
                   when :local       then Java::OrgEclipseJgitLib::Constants::R_HEADS
        Severity: Minor
        Found in lib/multi_git/jgit_backend/repository.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 traverse_set has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def traverse_set(current, parts, value, create)
                if parts.none?
                  raise
                end
                if parts.size == 1
        Severity: Minor
        Found in lib/multi_git/tree/builder.rb - About 1 hr to fix

          Method write has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def write(content, type = :blob)
                if content.kind_of? MultiGit::Builder
                  return content >> self
                end
                validate_type(type)
          Severity: Minor
          Found in lib/multi_git/jgit_backend/repository.rb - About 1 hr to fix

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

                def names
                  names = @from ? @from.names.dup : []
                  dirty_entries.each do |k,v|
                    if v
                      unless names.include? k
            Severity: Minor
            Found in lib/multi_git/tree/builder.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 changed? has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                  def changed?( path = '.' )
                    begin
                      new = traverse(path)
                    rescue Error::EntryDoesNotExist
                      return false unless from
            Severity: Minor
            Found in lib/multi_git/tree/builder.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 each_branch has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def each_branch(filter = :all)
                  return to_enum(:each_branch, filter) unless block_given?
                  rugged_filter = nil
                  if filter == :local || filter == :remote
                    rugged_filter = filter
            Severity: Minor
            Found in lib/multi_git/rugged_backend/repository.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 a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def initialize(path, options = {})
                  @git_binary = `which git`.chomp
                  options = initialize_options(path, options)
                  git_dir = options[:repository]
                  @git = Cmd.new({'GIT_CONFIG_NOSYSTEM'=>'1'}, git_binary, :git_dir => git_dir )
            Severity: Minor
            Found in lib/multi_git/git_backend/repository.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 each_branch has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def each_branch(filter = :all)
                  return to_enum(:each_branch, filter) unless block_given?
                  which = case filter
                          when :all, Regexp then [:a]
                          when :local       then []
            Severity: Minor
            Found in lib/multi_git/git_backend/repository.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 write has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def write(content, type = :blob)
                  if content.kind_of? MultiGit::Builder
                    return content >> self
                  end
                  validate_type(type)
            Severity: Minor
            Found in lib/multi_git/git_backend/repository.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 update has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                    def update(nx)
                      ru = repository.__backend__.updateRef(name)
                      begin
                        if !ru.try_lock(false)
                          raise
            Severity: Minor
            Found in lib/multi_git/jgit_backend/ref.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

            Avoid deeply nested control flow statements.
            Open

                          if follow
                            parts.push(*entry.target.split(SLASH))
                          else
                            if parts.none?
                              return entry
            Severity: Major
            Found in lib/multi_git/tree.rb - About 45 mins to fix
              Severity
              Category
              Status
              Source
              Language