lib/fs/iso9660/rock_ridge.rb
Method initialize
has a Cognitive Complexity of 19 (exceeds 8 allowed). Consider refactoring. Open
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.
- Read upRead up
- Create a ticketCreate a ticket
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
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.
- Create a ticketCreate a ticket
Method assembleComponents
has a Cognitive Complexity of 12 (exceeds 8 allowed). Consider refactoring. Open
Open
def assembleComponents(data)
out = ""; offset = 0
loop do
comp = RR_SL_COMPONENT.decode(data[offset..-1])
- Read upRead up
- Create a ticketCreate a ticket
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
Open
def length
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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