Method initialize
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
def initialize(from, to, options=undefined)
@source_encoding = Rubinius::Type.coerce_to_encoding from
@destination_encoding = Rubinius::Type.coerce_to_encoding to
if options.kind_of? Fixnum
- 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
File encoding.rb
has 444 lines of code (exceeds 250 allowed). Consider refactoring. Open
class EncodingError < StandardError
end
class Encoding
class UndefinedConversionError < EncodingError
Method last_error
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def last_error
error = Rubinius.invoke_primitive :encoding_converter_last_error, self
return if error.nil?
result = error[:result]
- 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 search
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def self.search(source, target)
if entry = TranscodingMap[source]
if entry[target]
return [source, target]
else
- 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 last_error
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
def last_error
error = Rubinius.invoke_primitive :encoding_converter_last_error, self
return if error.nil?
result = error[:result]
Method initialize
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(from, to, options=undefined)
@source_encoding = Rubinius::Type.coerce_to_encoding from
@destination_encoding = Rubinius::Type.coerce_to_encoding to
if options.kind_of? Fixnum
Method primitive_convert
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def primitive_convert(source, target, offset=nil, size=nil, options=0)
source = StringValue(source) if source
target = StringValue(target)
if offset.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 primitive_convert
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def primitive_convert(source, target, offset=nil, size=nil, options=0)
source = StringValue(source) if source
target = StringValue(target)
if offset.nil?
Method primitive_convert
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def primitive_convert(source, target, offset=nil, size=nil, options=0)
Method []
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.[](source, target)
key = "[#{source}, #{target}]"
path, converters = paths[key]
- 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 convpath
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def convpath
path = []
a = 0
b = @convpath.size - 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 asciicompat_encoding
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.asciicompat_encoding(string_or_encoding)
encoding = Rubinius::Type.try_convert_to_encoding string_or_encoding
return if not encoding or undefined.equal? encoding
return if encoding.ascii_compatible?
- 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 aliases
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.aliases
aliases = {}
EncodingMap.each do |n, r|
index = r.last
next unless index
- 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"