Showing 114 of 202 total issues
Class IP
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class IP < IPAddr
# A regular expression for matching IP addresses.
#
# @since 1.1.0
Method initialize
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(types)
super(types)
if types::ADDRESS_SIZE == 8
# NOTE: `long` and `unsigne long` are actually 4 bytes on
Method run
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def run
io_array = [@io, @stdin]
loop do
readable, _writable, errors = IO.select(io_array,nil,io_array)
- 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
Class Struct
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Struct < Memory
# The type system used by the struct.
#
# @return [CTypes::StructType]
Method generate
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def self.generate(version: 2,
serial: 0,
not_before: Time.now,
not_after: not_before + ONE_YEAR,
subject: 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
Consider simplifying this complex logical expression. Open
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)
end
Consider simplifying this complex logical expression. Open
if (byte == 45) || (byte == 46) || ((byte >= 48) && (byte <= 57)) || ((byte >= 65) && (byte <= 90)) || (byte == 95) || ((byte >= 97) && (byte <= 122)) || (byte == 126)
byte.chr
elsif byte == 0x20
'+'
else
Method build
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.build(method,path, # query string keyword arguments
query: nil,
query_params: nil,
# Basic-Auth keyword arguments
user: nil,
Method build
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def self.build(fields, alignment: nil, padding: true)
members = {}
max_alignment = 0
pack_string = String.new(encoding: 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 read_string
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def read_string(length=nil)
new_string = if (encoding = external_encoding)
String.new('', encoding: encoding)
else
String.new('')
- 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 14 (exceeds 5 allowed). Consider refactoring. Open
def parse(hexdump)
return enum_for(__method__,hexdump) unless block_given?
previous_address = nil
first_address = 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 encode_byte
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def self.encode_byte(byte, format: :decimal, zero_pad: false, **kwargs)
case format
when :decimal
if zero_pad then "&#%.7d;" % byte
else "&#%d;" % byte
- 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 14 (exceeds 5 allowed). Consider refactoring. Open
def self.escape_byte(byte,**kwargs)
if (byte >= 0) && (byte <= 0xff)
if (byte == 45) || (byte == 46) || ((byte >= 48) && (byte <= 57)) || ((byte >= 65) && (byte <= 90)) || (byte == 95) || ((byte >= 97) && (byte <= 122)) || (byte == 126)
byte.chr
elsif byte == 0x20
- 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 generate
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.generate(version: 2,
serial: 0,
not_before: Time.now,
not_after: not_before + ONE_YEAR,
subject: nil,
Method escape_byte
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def self.escape_byte(byte,**kwargs)
if (byte >= 0) && (byte <= 0xff)
if (byte == 33) || (byte == 36) || (byte == 38) || ((byte >= 39) && (byte <= 59)) || (byte == 61) || ((byte >= 63) && (byte <= 91)) || (byte == 93) || (byte == 95) || ((byte >= 97) && (byte <= 122)) || (byte == 126)
byte.chr
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 generator
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def self.generator(**kwargs)
if kwargs.empty?
DEFAULT
else
rules = []
- 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 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def poll
sockets = [@socket] + client_connections + server_connections
readable, _writtable, errors = IO.select(sockets,nil,sockets)
Method each
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def each
return enum_for(__method__) unless block_given?
io = IO.popen(command_argv('-v','-l',@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 context
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.context(version: nil,
min_version: nil,
max_version: nil,
verify: :none,
key: nil,
Method parse
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse(hexdump)
return enum_for(__method__,hexdump) unless block_given?
previous_address = nil
first_address = nil