jphastings/rubyzip

View on GitHub

Showing 44 of 44 total issues

Method parse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def parse(original_size, compressed_size, relative_header_offset = nil, disk_start_number = nil)
      @original_size = extract(8, 'Q<') if original_size == 0xFFFFFFFF
      @compressed_size = extract(8, 'Q<') if compressed_size == 0xFFFFFFFF
      @relative_header_offset = extract(8, 'Q<') if relative_header_offset && relative_header_offset == 0xFFFFFFFF
      @disk_start_number = extract(4, 'V') if disk_start_number && disk_start_number == 0xFFFF
Severity: Minor
Found in lib/zip/extra_field/zip64.rb - About 25 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 write_e_o_c_d has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def write_e_o_c_d(io, offset, cdir_size) #:nodoc:
      tmp = [
        END_OF_CDS,
        0, # @numberOfThisDisk
        0, # @numberOfDiskWithStartOfCDir
Severity: Minor
Found in lib/zip/central_directory.rb - About 25 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 create_directory has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def create_directory(dest_path)
      return if ::File.directory?(dest_path)
      if ::File.exist?(dest_path)
        if block_given? && yield(self, dest_path)
          ::FileUtils::rm_f dest_path
Severity: Minor
Found in lib/zip/entry.rb - About 25 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 merge has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def merge(binstr)
      return if binstr.empty?
      size, content = initial_parse(binstr)
      size or return
      @flag, mtime, atime, ctime = content.unpack("CVVV")
Severity: Minor
Found in lib/zip/extra_field/universal_time.rb - About 25 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