Showing 8 of 46 total issues
Method encode
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def encode(plain)
return EncodedByteArray::EMPTY if plain.empty?
plain = plain.bytes unless plain.is_a?(Array)
expected_length = @table.encoded_length(plain)
Method encode
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def encode(plain)
return EncodedByteArray::EMPTY if plain.empty?
plain = plain.bytes unless plain.is_a?(Array)
expected_length = @table.encoded_length(plain)
- 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 implement
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def implement(encoding, code, implementation = nil, alphabet = nil, alphabet_encoding = nil)
Method decode
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def decode(encoded)
return DecodedByteArray::EMPTY if encoded.empty?
unless encoded.is_a?(Array)
encoded = encoded.force_encoding(@table.encoding).bytes
- 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 decode
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def decode(encoded)
return DecodedByteArray::EMPTY if encoded.empty?
unless encoded.is_a?(Array)
encoded = encoded.force_encoding(@table.encoding).bytes
- 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 calculate_encoding
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def calculate_encoding(encoding:)
invalid_ord = @ords.find { |ord| ord > 255 }
raise AlphabetOutOfBoundary, invalid_ord if invalid_ord
if encoding
- 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 decode
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def decode(encoded)
return DecodedByteArray::EMPTY if encoded.empty?
unless encoded.is_a?(Array)
encoded = encoded.force_encoding(@table.encoding).bytes
- 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 decode
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def decode(encoded)
return DecodedByteArray::EMPTY if encoded.empty?
unless encoded.is_a?(Array)
encoded = encoded.force_encoding(@table.encoding).bytes
- 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"