ManageIQ/manageiq-smartstate

View on GitHub
lib/fs/iso9660/rock_ridge.rb

Summary

Maintainability
B
4 hrs
Test Coverage

Method initialize has a Cognitive Complexity of 19 (exceeds 8 allowed). Consider refactoring.
Open

    def initialize(de, suff)
      raise "No DirectoryEntry specified." if de.nil?
      raise "The specified DirectoryEntry has no System Use Area." if de.sua.nil?

      # Root directories need to skip SUSP header.
Severity: Minor
Found in lib/fs/iso9660/rock_ridge.rb - About 2 hrs 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 initialize has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def initialize(de, suff)
      raise "No DirectoryEntry specified." if de.nil?
      raise "The specified DirectoryEntry has no System Use Area." if de.sua.nil?

      # Root directories need to skip SUSP header.
Severity: Minor
Found in lib/fs/iso9660/rock_ridge.rb - About 1 hr to fix

Method assembleComponents has a Cognitive Complexity of 12 (exceeds 8 allowed). Consider refactoring.
Open

    def assembleComponents(data)
      out = ""; offset = 0
      loop do
        comp = RR_SL_COMPONENT.decode(data[offset..-1])

Severity: Minor
Found in lib/fs/iso9660/rock_ridge.rb - About 55 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 Iso9660::SparseFile#length is defined at both lib/fs/iso9660/rock_ridge.rb:222 and lib/fs/iso9660/rock_ridge.rb:231.
Open

    def length
Severity: Minor
Found in lib/fs/iso9660/rock_ridge.rb by rubocop

Checks for duplicated instance (or singleton) method definitions.

Example:

# bad

def foo
  1
end

def foo
  2
end

Example:

# bad

def foo
  1
end

alias foo bar

Example:

# good

def foo
  1
end

def bar
  2
end

Example:

# good

def foo
  1
end

alias bar foo

There are no issues that match your filters.

Category
Status