Showing 46 of 67 total issues
File constants.rb
has 328 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Plum
module HPACK
# RFC7541 Appendix A
# index is starting from 0
STATIC_TABLE = [
Method start_tls_server
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def start_tls_server(&block)
ctx = OpenSSL::SSL::SSLContext.new
ctx.alpn_select_cb = -> protocols { "h2" }
ctx.cert = TLS_CERT
ctx.key = TLS_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 transform_options
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def transform_options
if @options[:config]
dsl = DSL::Config.new.tap { |c| c.instance_eval(File.read(@options[:config])) }
config = dsl.config
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 setup_parser
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def setup_parser
parser = OptionParser.new do |o|
o.on "-C", "--config PATH", "Load PATH as a config" do |arg|
@options[:config] = arg
end
Method start_tls_server
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def start_tls_server(&block)
ctx = OpenSSL::SSL::SSLContext.new
ctx.alpn_select_cb = -> protocols { "h2" }
ctx.cert = TLS_CERT
ctx.key = TLS_KEY
Method test_inadequate_security_ssl_socket
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_inadequate_security_ssl_socket
run = false
ctx = OpenSSL::SSL::SSLContext.new
ctx.alpn_select_cb = -> protocols { "h2" }
Method new_env
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def new_env(h, data)
ebase = {
"rack.version" => ::Rack::VERSION,
"rack.input" => StringIO.new(data),
"rack.errors" => $stderr,
- 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 new_env
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def new_env(h, data)
ebase = {
"rack.version" => ::Rack::VERSION,
"rack.input" => StringIO.new(data),
"rack.errors" => $stderr,
Method setup_plum
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def setup_plum
@plum.on(:connection_error) { |ex| @logger.error(ex) }
# @plum.on(:stream) { |stream| @logger.debug("new stream: #{stream}") }
@plum.on(:stream_error) { |stream, ex|
Method transform_options
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def transform_options
if @options[:config]
dsl = DSL::Config.new.tap { |c| c.instance_eval(File.read(@options[:config])) }
config = dsl.config
else
Method initialize
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def initialize(lc)
if lc[:certificate] && lc[:certificate_key]
cert = File.read(lc[:certificate])
key = File.read(lc[:certificate_key])
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 validate_received_frame
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def validate_received_frame(frame)
if @state == :waiting_settings && !(Frame::Settings === frame)
raise RemoteConnectionError.new(:protocol_error)
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 test_inadequate_security_ssl_socket
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def test_inadequate_security_ssl_socket
run = false
ctx = OpenSSL::SSL::SSLContext.new
ctx.alpn_select_cb = -> protocols { "h2" }
- 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 update_dependency
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def update_dependency(weight: nil, parent: nil, exclusive: nil)
raise RemoteStreamError.new(:protocol_error, "A stream cannot depend on itself.") if parent == self
if weight
@weight = weight
- 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 request
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def request(headers, body, options, &headers_cb)
headers = { ":method" => nil,
":path" => nil,
":authority" => @config[:hostname],
":scheme" => @config[:https] ? "https" : "http",
Method test_server_must_raise_frame_size_error_when_exeeeded_max_size
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_server_must_raise_frame_size_error_when_exeeeded_max_size
_settings = "".push_uint16(Frame::Settings::SETTINGS_TYPE[:max_frame_size]).push_uint32(2**14)
limit = 2 ** 14
new_con = -> (&blk) {
Method initialize
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(lc)
if lc[:certificate] && lc[:certificate_key]
cert = File.read(lc[:certificate])
key = File.read(lc[:certificate_key])
else
Method start
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def start
#trap(:INT) { @state = :ee }
#require "lineprof"
#Lineprof.profile(//){
@state = :running
- 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 handle_request
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def handle_request(stream, headers, data)
env = new_env(headers, data)
r_status, r_rawheaders, r_body = @app.call(env)
r_headers, r_extheaders = extract_headers(r_status, r_rawheaders)
if @config[:server_push] && @plum.push_enabled?
- 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 setup_plum
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def setup_plum
@plum.on(:connection_error) { |ex| @logger.error(ex) }
# @plum.on(:stream) { |stream| @logger.debug("new stream: #{stream}") }
@plum.on(:stream_error) { |stream, ex|
- 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"