Method rb_integer_pack
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def self.rb_integer_pack(value, words, numwords, wordsize, nails, flags)
digits = INTEGER_PACK_DIGITS
numbytes = numwords * wordsize
nibble_size = numbytes * 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"
Further reading
Method rb_integer_pack
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.rb_integer_pack(value, words, numwords, wordsize, nails, flags)
digits = INTEGER_PACK_DIGITS
numbytes = numwords * wordsize
nibble_size = numbytes * 2
Method rb_str_conv_enc_opts
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.rb_str_conv_enc_opts(str, from, to, flags, opts)
return str if to.nil?
return str if from == to
if (to.ascii_compatible? and str.ascii_only?) or to == Encoding::ASCII_8BIT
- 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 rb_integer_pack
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.rb_integer_pack(value, words, numwords, wordsize, nails, flags)
Method coerce
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.coerce(x, y, error=false)
begin
ary = y.coerce x
rescue
if error
- 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 rb_str_conv_enc_opts
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.rb_str_conv_enc_opts(str, from, to, flags, opts)
Avoid too many return
statements within this method. Open
return status == :finished ? result : str
Avoid too many return
statements within this method. Open
return 1