hannesg/multi_git

View on GitHub
lib/multi_git/tree/builder.rb

Summary

Maintainability
C
7 hrs
Test Coverage

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 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 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 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 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 >> has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def >>(repository)
          ent = []
          dirty_entries.each do |name, entry|
            if entry
              object = repository.write(entry)
    Severity: Minor
    Found in lib/multi_git/tree/builder.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

    Avoid too many return statements within this method.
    Open

              return true
    Severity: Major
    Found in lib/multi_git/tree/builder.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return new != old
      Severity: Major
      Found in lib/multi_git/tree/builder.rb - About 30 mins to fix

        There are no issues that match your filters.

        Category
        Status