Method tar
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def tar(path)
string_io = StringIO.new('')
Gem::Package::TarWriter.new(string_io) do |tar|
Find.find(path) do |file|
# do not include the git files
- 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_zip_entries
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def write_zip_entries(path, sub_path, io)
search_path = File.join(path, sub_path)
Find.find(path) do |file|
zip_file_path = file.sub(%r{^#{Regexp.escape search_path}\/?}, '')
next if @exclude_git && zip_file_path.start_with?('.git')
- 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 zip
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def zip(path)
string_io = Zip::OutputStream.write_buffer do |zio|
Find.find(path) do |file|
# do not process directories && do not include the Git DB files
next if File.directory?(file) || (@exclude_git && file.start_with?("#{path}/.git"))
- 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"