Showing 32 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!
- 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
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
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])
- 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 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)
- 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 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!
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
- 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 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)
- 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 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
- 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 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])
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
- 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 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
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)
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
- 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 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
- 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 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
- 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 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 )
- 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 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 []
- 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 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)
- 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 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
- 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
Avoid deeply nested control flow statements. Open
if follow
parts.push(*entry.target.split(SLASH))
else
if parts.none?
return entry