Showing 110 of 197 total issues
Method escape_byte
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.escape_byte(byte)
if byte >= 0x00 && byte <= 0xff
if byte == 0x22
"\\\""
elsif byte == 0x5d
- 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_string
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def get_string(offset,length=nil)
if (offset < 0) || (offset >= size)
raise(IndexError,"offset #{offset} is out of bounds: 0...#{size - 1}")
elsif (length && (offset + length) > size)
raise(IndexError,"offset #{offset} or length #{length} is out of bounds: 0...#{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 ip
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def ip(ip)
address = ip.to_s
ip = IPAddr.new(ip) unless ip.kind_of?(IPAddr)
prefixes = if ip.ipv6? then @ipv6_prefixes
- 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 pop3_connect
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def pop3_connect(host, port: DEFAULT_PORT,
ssl: nil,
user: ,
password: )
host = DNS::IDN.to_ascii(host)
Method to_s
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def to_s
message = []
if @from
message << "From: #{@from}"
Method parse
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.parse(string)
kwargs = {}
params = {}
string.split(/;\s+/) do |field|
Method connect_uri
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.connect_uri(url, ssl: nil,
user: nil,
password: nil,
**kwargs, &block)
case url
Method each_unique_substring
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def each_unique_substring(min=1,&block)
return enum_for(__method__,min) unless block
unique_strings = {}
- 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 stream
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def stream(io, block_size: 16384, output: nil)
unless block_given?
output ||= String.new(encoding: Encoding::ASCII_8BIT)
end
- 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 parse
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.parse(string)
kwargs = {}
params = {}
string.split(/;\s+/) do |field|
- 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 padding
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.padding(new_padding=nil)
unless new_padding.nil?
@padding = new_padding
else
if @padding.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 parse_line
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def parse_line(line)
if @type.kind_of?(CTypes::CharType)
# because od/hexdump print the ' ' char as white space,
# we need special parsing logic here.
if (start_index = line.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"
Further reading
Method unescape
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.unescape(data)
unescaped = String.new(encoding: Encoding::UTF_8)
scanner = StringScanner.new(data)
until scanner.eos?
- 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 poll
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def poll
sockets = [@socket] + client_connections + server_connections
readable, _writtable, errors = IO.select(sockets,nil,sockets)
- 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 parse
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.parse(path=PATH)
return enum_for(__method__,path) unless block_given?
type = 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 parse
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.parse(path=PATH)
return enum_for(__method__,path) unless block_given?
io = if File.extname(path) == '.gz' then Zlib::GzipReader.open(path)
else File.new(path)
- 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 8 (exceeds 5 allowed). Consider refactoring. Open
def initialize(string, offset: , length: )
if length == Float::INFINITY
length = string.bytesize - offset
end
- 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 telnet_connect
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def telnet_connect(host, # connection options
proxy: Telnet.proxy,
port: Telnet::DEFAULT_PORT,
binmode: false,
wait_time: 0,
- 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 encode_bytes
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def encode_bytes(include: nil, exclude: nil)
included = (Chars::CharSet.new(*include) if include)
excluded = (Chars::CharSet.new(*exclude) if exclude)
formatted = String.new(encoding: ::Encoding::UTF_8)
- 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 escape_byte
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.escape_byte(byte,**kwargs)
if (byte == 42) || (byte == 45) || (byte == 46) || ((byte >= 48) && (byte <= 57)) || ((byte >= 65) && (byte <= 90)) || (byte == 95) || ((byte >= 97) && (byte <= 122))
byte.chr
else
encode_byte(byte,**kwargs)
- 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"