Showing 4 of 16 total issues
Class BinaryStruct
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class BinaryStruct
SIZES = {
'A' => 1, # String with trailing NULs and spaces removed
'a' => 1, # String
'B' => 1, # Extract bits from each character (MSB first)
Method encode_hash
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def encode_hash(hash)
data = ""
@definition.each_slice(2) do |format, name|
raise "member not found: #{name}" unless name.nil? || hash.has_key?(name)
value = unless name.nil?
- 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 get_size
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.get_size(definition)
size = 0
definition.each_slice(2) do |format, _|
type, count = format[0, 1], format[1..-1]
modifier, modcount = count[0, 1], count[1..-1]
- 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 offset
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def offset(attr)
offset = 0
self.definition.each_slice(2) do |format, name|
return offset if name == attr
- 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"