Method append_primary_bytes
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def append_primary_bytes
@last_leading_byte = nil
@collation_elements.each do |collation_element|
bytes = integer_to_bytes_array(level_weight(collation_element, PRIMARY_LEVEL))
- 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 init_tertiary_constants
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def init_tertiary_constants
@case_switch = @case_first == :upper ? CASE_SWITCH : NO_CASE_SWITCH
if @case_first
@tertiary_mask = KEEP_CASE_MASK
Method init_tertiary_constants
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def init_tertiary_constants
@case_switch = @case_first == :upper ? CASE_SWITCH : NO_CASE_SWITCH
if @case_first
@tertiary_mask = KEEP_CASE_MASK
- 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 append_tertiary_byte
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def append_tertiary_byte(tertiary)
if tertiary == @tertiary_common
@common_count += 1
else
if @tertiary_common == TERTIARY_COMMON_NORMAL && @tertiary_common < tertiary
- 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 initialize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def initialize(collation_elements, options = {})
raise ArgumentError, "second argument should be an options hash, not `#{options}`. Do you mean `:case_first => #{options}`?" unless options.kind_of? Hash
case_first = options[:case_first]
raise ArgumentError, "invalid case-first options '#{case_first.inspect}'" unless VALID_CASE_FIRST_OPTIONS.include?(case_first)
- 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 build_bytes_array
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def build_bytes_array
@bytes_array = []
append_primary_bytes
append_secondary_bytes unless @maximum_level && (@maximum_level < 2)
- 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"