Showing 27 of 37 total issues
Method execute!
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
def execute!
# here sets default options
options = {
:port => 8388,
:local_addr => '0.0.0.0',
Method execute!
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
def execute!
# here sets default options
options = {
:server => '0.0.0.0',
:port => 8388,
Method bytes_to_key1
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def bytes_to_key1(salt, data, count, nkey, niv)
key = ''
iv = ''
md_buf = ''
- 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 build!
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build! conn
cipher = nil
protocols = @cfg_ary.map do | klass, params|
case klass.to_s
File tls_ticket.rb
has 262 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'lrucache'
module ShadowsocksRuby
module Protocols
# TLS 1.2 Obfuscation Protocol
Method tcp_receive_from_localbackend_first_packet
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def tcp_receive_from_localbackend_first_packet n
data = async_recv 10
if (data =~ /^GET|^POST/) == nil
if @params[:compatible]
@buffer << data << async_recv(n - data.length)
- 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_client_hello
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def recv_client_hello
data = async_recv 3
if data != [CTYPE_Handshake, *VERSION_TLS_1_0].pack("C3")
if @params[:compatible]
@buffer = data
Method recv_client_hello
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def recv_client_hello
data = async_recv 3
if data != [CTYPE_Handshake, *VERSION_TLS_1_0].pack("C3")
if @params[:compatible]
@buffer = data
- 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 tcp_receive_from_localbackend_first_packet
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def tcp_receive_from_localbackend_first_packet n
# check version
version = async_recv(1).unpack("C").first
if version != SOCKS5
raise PharseError, "SOCKS version not supported: #{version.inspect}"
Method tcp_receive_from_client_first_packet
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def tcp_receive_from_client_first_packet n
# check version
version = async_recv(1).unpack("C").first
if version != SOCKS5
raise PharseError, "SOCKS version not supported: #{version.inspect}"
Method tcp_send_to_remoteserver_first_packet
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def tcp_send_to_remoteserver_first_packet data
if data.length > 30 + 64
headlen = 30 + Random.rand(64 + 1)
else
headlen = data.length
Method send_client_hello
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def send_client_hello
client_hello = ""
client_hello << [*VERSION_TLS_1_2].pack("C2") # ProtocolVersion
client_hello << get_random # Random len 32
Method execute!
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def execute!
# here sets default options
options = {
:port => 8388,
:local_addr => '0.0.0.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 initialize
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize
@options = @@options
@totalcounter = 0
@maxcounter = 0
Method tcp_receive_from_localbackend_first_packet
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def tcp_receive_from_localbackend_first_packet n
data = async_recv 10
if (data =~ /^GET|^POST/) == nil
if @params[:compatible]
@buffer << data << async_recv(n - data.length)
Method execute!
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def execute!
# here sets default options
options = {
:server => '0.0.0.0',
:port => 8388,
- 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 tcp_send_to_remoteserver_first_packet
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def tcp_send_to_remoteserver_first_packet data
if data.length > 30 + 64
headlen = 30 + Random.rand(64 + 1)
else
headlen = data.length
- 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 pressure_control
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def pressure_control
@plexer ||= nil
if @plexer != nil
if get_outbound_data_size >= PressureLevel
@plexer.pause unless @plexer.paused?
- 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 9 (exceeds 5 allowed). Consider refactoring. Open
def initialize
@options = @@options
@totalcounter = 0
@maxcounter = 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 receive_data
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def receive_data data
if @fiber.alive?
@buffer << data
if @wait_length == -1 || @buffer.size >= @wait_length
@fiber.resume
- 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"