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={})
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|
- Read upRead up
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
- Read upRead up
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)
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|
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
- Read upRead up
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
- Read upRead up
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(', ')})" }
- Read upRead up
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 }
- Read upRead up
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]
- Read upRead up
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"