Showing 55 of 55 total issues
Method read_eocds
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def read_eocds(io) # :nodoc:
base_location, data = eocd_data(io)
eocd_location = data.rindex([END_OF_CD_SIG].pack('V'))
raise Error, 'Zip end of central directory signature not found' unless eocd_location
- 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 open_buffer
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def open_buffer(io = ::StringIO.new, create: false,
restore_ownership: DEFAULT_RESTORE_OPTIONS[:restore_ownership],
restore_permissions: DEFAULT_RESTORE_OPTIONS[:restore_permissions],
restore_times: DEFAULT_RESTORE_OPTIONS[:restore_times],
compression_level: ::Zip.default_compression)
- 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 10 (exceeds 5 allowed). Consider refactoring. Open
def read(length = nil, outbuf = +'')
return (length.nil? || length.zero? ? '' : nil) if eof
while length.nil? || (buffer.bytesize < length)
break if input_finished?
- 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_ftype_from_c_dir_entry
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def set_ftype_from_c_dir_entry # :nodoc:
@ftype = case @fstype
when ::Zip::FSTYPE_UNIX
@unix_perms = (@external_file_attributes >> 16) & 0o7777
case (@external_file_attributes >> 28)
- 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 gets
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def gets(a_sep_string = $INPUT_RECORD_SEPARATOR, number_of_bytes = nil)
@lineno = @lineno.next
if number_of_bytes.respond_to?(:to_int)
number_of_bytes = number_of_bytes.to_int
Method read_local_entry
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def read_local_entry(io) # :nodoc:
@dirty = false # No changes at this point.
@local_header_offset = io.tell
static_sized_fields_buf = io.read(::Zip::LOCAL_ENTRY_STATIC_HEADER_LENGTH) || ''
Method initialize
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize
super()
set_usize(400, 256)
set_title('rubyzip')
signal_connect(Gtk::Window::SIGNAL_DESTROY) { Gtk.main_quit }
Method merge
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def merge(binstr)
return if binstr.empty?
size, content = initial_parse(binstr)
(size && content) || return
- 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 pack_local_entry
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def pack_local_entry # :nodoc:
zip64 = @extra['Zip64']
[::Zip::LOCAL_ENTRY_SIGNATURE,
@version_needed_to_extract, # version needed to extract
@gp_flags, # @gp_flags
- 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 save_splited_part
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def save_splited_part(
zip_file, partial_zip_file_name, zip_file_size,
szip_file_index, segment_size, segment_count
)
ssegment_size = zip_file_size - zip_file.pos
- 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 gather_fileinfo_from_srcpath
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def gather_fileinfo_from_srcpath(src_path) # :nodoc:
stat = file_stat(src_path)
@ftype = case stat.ftype
when 'file'
if name_is_directory?
- 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 split
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def split(
zip_file_name, segment_size: MAX_SEGMENT_SIZE,
delete_original: true, partial_zip_file_name: nil
)
raise Error, "File #{zip_file_name} not found" unless ::File.exist?(zip_file_name)
- 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 extract_files
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def extract_files
selected_items = []
unselected_items = []
lv_item = entry_list_view.first_child
while lv_item
- 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 on_success_replace
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def on_success_replace
dirname, basename = ::File.split(name)
::Dir::Tmpname.create(basename, dirname) do |tmp_filename|
if yield tmp_filename
::File.rename(tmp_filename, name)
- 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 save_splited_part
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
zip_file, partial_zip_file_name, zip_file_size,
szip_file_index, segment_size, segment_count
Consider simplifying this complex logical expression. Open
if zip64? || @size.nil? || @size >= 0xFFFFFFFF || @compressed_size >= 0xFFFFFFFF
@version_needed_to_extract = VERSION_NEEDED_TO_EXTRACT_ZIP64
zip64 = @extra['Zip64'] || @extra.create('Zip64')
# Local header always includes size and compressed size.
Method put_next_entry
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
entry_name, comment = '', extra = ExtraField.new,
compression_method = Entry::DEFLATED, level = Zip.default_compression
Method find
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.find(path, zip_file_pattern = /\.zip$/i)
Find.find(path) do |filename|
yield(filename)
next unless zip_file_pattern.match(filename) && File.file?(filename)
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
def read(length = nil, outbuf = +'')
return (length.nil? || length.zero? ? '' : nil) if eof
if length.nil? || (@read_so_far + length) > decompressed_size
length = decompressed_size - @read_so_far
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
def initialize(
zipfile = '', name = '',
comment: '', size: nil, compressed_size: 0, crc: 0,
compression_method: DEFLATED,
compression_level: ::Zip.default_compression,
- 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"