gabynaiman/eternity

View on GitHub

Showing 10 of 14 total issues

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

  class Repository

    attr_reader :name, :id, :branches
    
    def initialize(name, options={})
Severity: Minor
Found in lib/eternity/repository.rb - About 3 hrs to fix

    Method calculate_delta has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

          def calculate_delta
            if current_commit.nil?
              target_commit.with_index do |target_index| 
                target_index.each_with_object({}) do |(collection, collection_index), hash|
                  hash[collection] = collection_index.ids.each_with_object({}) do |id, h|
    Severity: Minor
    Found in lib/eternity/patch.rb - About 3 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 merge has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

          def merge(deltas, base_index=nil)
            union(deltas).each_with_object({}) do |(collection, elements), hash|
              hash[collection] = {}
              elements.each do |id, changes|
                current_change = TrackFlatter.flatten changes
    Severity: Minor
    Found in lib/eternity/delta.rb - About 3 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

    Class Commit has 25 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class Commit
    
        attr_reader :id
    
        def initialize(id)
    Severity: Minor
    Found in lib/eternity/commit.rb - About 2 hrs to fix

      Method calculate_delta has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def calculate_delta
              if current_commit.nil?
                target_commit.with_index do |target_index| 
                  target_index.each_with_object({}) do |(collection, collection_index), hash|
                    hash[collection] = collection_index.ids.each_with_object({}) do |id, h|
      Severity: Minor
      Found in lib/eternity/patch.rb - About 1 hr to fix

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

            def self.create(options)
              raise 'Author must be present' if options[:author].to_s.strip.empty?
              raise 'Message must be present' if options[:message].to_s.strip.empty?
        
              # TODO: Move to Repository and Patch
        Severity: Minor
        Found in lib/eternity/commit.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 base_of has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def self.base_of(commit_1, commit_2)
              history_1 = [commit_1.id]
              history_2 = [commit_2.id]
        
              base_1 = commit_1
        Severity: Minor
        Found in lib/eternity/commit.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 checkout has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def checkout(options)
              raise "Can't checkout with uncommitted changes" if changes?
        
              locker.lock! :checkout do
                Eternity.logger.info(self.class) { "Checkout #{name} (#{options.map { |k,v| "#{k}: #{v}" }.join(', ')})" }
        Severity: Minor
        Found in lib/eternity/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 normalize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

              def normalize(data)
                if data.kind_of? Hash
                  sorted_data = Hash[data.sort_by { |k,v| k.to_s }]
                  sorted_data.each { |k,v| sorted_data[k] = normalize v }
        
        
        Severity: Minor
        Found in lib/eternity/blob.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 pull has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def pull
              raise "Can't pull with uncommitted changes" if changes?
              raise "Branch not found: #{current_branch}" unless Branch.exists? current_branch
        
              target_commit = Branch[current_branch]
        Severity: Minor
        Found in lib/eternity/repository.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

        Severity
        Category
        Status
        Source
        Language