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
Class Client
has 42 methods (exceeds 20 allowed). Consider refactoring. Open
class Client
include Logging
HpkeSymmetricCipherSuit = \
ECHConfig::ECHConfigContents::HpkeKeyConfig::HpkeSymmetricCipherSuite
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 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 send_new_client_hello
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def send_new_client_hello(ch1,
hrr,
extensions,
binder_key = nil,
ech_state = nil)
Method sign_grease_psk_binder
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def sign_grease_psk_binder(ch1: nil,
hrr: nil,
ch_outer:,
inner_psk:,
binder_key:)
Method gen_ch_extensions
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def gen_ch_extensions
exs = Message::Extensions.new
# server_name
exs << Message::Extension::ServerName.new(@hostname)
- 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 check_invalid_certificate
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def check_invalid_certificate(ct, ch)
return :illegal_parameter unless ct.appearable_extensions?
return :unsupported_extension \
unless ct.certificate_list.map(&:extensions)
- 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 softfail_check_certificate_status
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.softfail_check_certificate_status(res, cert, chain)
ocsp_response = res
cid = OpenSSL::OCSP::CertificateId.new(cert, chain.first)
# When NOT received OCSPResponse in TLS handshake, this method will
- 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_new_client_hello
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def send_new_client_hello(ch1,
hrr,
extensions,
binder_key = nil,
ech_state = nil)
Avoid too many return
statements within this method. Open
return false if @settings[:check_certificate_status] &&
Avoid too many return
statements within this method. Open
return false \
Avoid too many return
statements within this method. Open
return false if !rsl.nil? && (rsl < 64 || rsl > 2**14 + 1)
Avoid too many return
statements within this method. Open
return false if !@settings[:ech_config].nil? && ehcs.empty?
Method send_new_client_hello
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def send_new_client_hello(ch1,
hrr,
extensions,
binder_key = nil,
ech_state = 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"