fontist/excavate

View on GitHub
lib/excavate/extractors/cpio/cpio.rb

Summary

Maintainability
A
3 hrs
Test Coverage

Method validate has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

  def validate
    raise "Invalid magic #{magic.inspect}" if magic != 0x070701
    raise "Invalid ino #{ino.inspect}" if ino < 0
    raise "Invalid mode #{mode.inspect}" if mode < 0
    raise "Invalid uid #{uid.inspect}" if uid < 0
Severity: Minor
Found in lib/excavate/extractors/cpio/cpio.rb - About 1 hr 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 each has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def each(&block)
    while true
      entry = read
      break if entry.nil?
      # The CPIO format has the end-of-stream marker as a file called "TRAILER!!!"
Severity: Minor
Found in lib/excavate/extractors/cpio/cpio.rb - About 1 hr 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 verify_correct_read has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def verify_correct_read(entry)
    # Read and throw away the whole file if not read at all.
    entry.file.tap do |file|
      if file.nil? ||  file.remaining == 0
        # All OK! :)
Severity: Minor
Found in lib/excavate/extractors/cpio/cpio.rb - About 45 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

There are no issues that match your filters.

Category
Status