Showing 96 of 96 total issues
Method connect
has a Cognitive Complexity of 173 (exceeds 5 allowed). Consider refactoring. Open
def connect
@transcript = Transcript.new
key_schedule = nil # TTTLS13::KeySchedule
psk = nil
priv_keys = {} # Hash of NamedGroup => OpenSSL::PKey::$Object
- 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 client.rb
has 823 lines of code (exceeds 250 allowed). Consider refactoring. Open
module TTTLS13
using Refinements
module ClientState
# initial value is 0, eof value is -1
Method connect
has 298 lines of code (exceeds 25 allowed). Consider refactoring. Open
def connect
@transcript = Transcript.new
key_schedule = nil # TTTLS13::KeySchedule
psk = nil
priv_keys = {} # Hash of NamedGroup => OpenSSL::PKey::$Object
Method accept
has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring. Open
def accept
@transcript = Transcript.new
key_schedule = nil # TTTLS13::KeySchedule
priv_key = nil # OpenSSL::PKey::$Object
hs_wcipher = nil # TTTLS13::Cryptograph::$Object
- 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 accept
has 167 lines of code (exceeds 25 allowed). Consider refactoring. Open
def accept
@transcript = Transcript.new
key_schedule = nil # TTTLS13::KeySchedule
priv_key = nil # OpenSSL::PKey::$Object
hs_wcipher = nil # TTTLS13::Cryptograph::$Object
File server.rb
has 438 lines of code (exceeds 250 allowed). Consider refactoring. Open
module TTTLS13
using Refinements
module ServerState
# initial value is 0, eof value is -1
Class KeySchedule
has 42 methods (exceeds 20 allowed). Consider refactoring. Open
class KeySchedule
# @param psk [String]
# @param shared_secret [String]
# @param cipher_suite [TTTLS13::CipherSuite]
# @param transcript [TTTLS13::Transcript]
Class Client
has 42 methods (exceeds 20 allowed). Consider refactoring. Open
class Client
include Logging
HpkeSymmetricCipherSuit = \
ECHConfig::ECHConfigContents::HpkeKeyConfig::HpkeSymmetricCipherSuite
Class Server
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class Server
include Logging
attr_reader :transcript
File ech.rb
has 288 lines of code (exceeds 250 allowed). Consider refactoring. Open
module TTTLS13
using Refinements
SUPPORTED_ECHCONFIG_VERSIONS = ["\xfe\x0d"].freeze
private_constant :SUPPORTED_ECHCONFIG_VERSIONS
Method valid_settings?
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def valid_settings?
mod = CipherSuite
defined_cipher_suites = mod.constants.map { |c| mod.const_get(c) }
return false \
unless (@settings[:cipher_suites] - defined_cipher_suites).empty?
- 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 deserialize
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def self.deserialize(binary)
raise Error::ErrorAlerts, :internal_error if binary.nil?
return nil if binary.length < 2
pskids_len = Convert.bin2i(binary.slice(0, 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 deserialize_extension
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def deserialize_extension(binary, extension_type, msg_type)
raise Error::ErrorAlerts, :internal_error if binary.nil?
case extension_type
when ExtensionType::SERVER_NAME
Method obj2html
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def obj2html(obj)
if obj.is_a?(OpenSSL::X509::Certificate)
obj.to_pem.gsub("\n", '<br>')
elsif obj.is_a?(Numeric) ||
obj.is_a?(TrueClass) || obj.is_a?(FalseClass)
- 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 recv_message
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def recv_message(receivable_ccs:, cipher:)
return @message_queue.shift unless @message_queue.empty?
messages = nil
orig_msgs = []
- 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
raise Error::ErrorAlerts, :internal_error \
unless (@msg_type == HandshakeType::CLIENT_HELLO &&
@key_share_entry.length >= 0 &&
@key_share_entry.all?(&:valid_key_share_client_hello?)) ||
(@msg_type == HandshakeType::SERVER_HELLO &&
Method read
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def read(nst_process)
# secure channel has not established yet
raise Error::ConfigError \
unless (@side == :client && @state == ClientState::CONNECTED) ||
(@side == :server && @state == ServerState::CONNECTED)
- 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 send_client_hello
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def send_client_hello(extensions, binder_key = nil)
ch = Message::ClientHello.new(
cipher_suites: CipherSuites.new(@settings[:cipher_suites]),
extensions: extensions
)
Method gen_ch_extensions
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def gen_ch_extensions
exs = Message::Extensions.new
# server_name
exs << Message::Extension::ServerName.new(@hostname)
Method deserialize
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def self.deserialize(binary, msg_type)
raise Error::ErrorAlerts, :internal_error if binary.nil?
case msg_type
when HandshakeType::CLIENT_HELLO
- 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"