lib/rex/proto/http/web_socket/amazon_ssm.rb
File amazon_ssm.rb
has 311 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
require 'bindata'
module Rex::Proto::Http::WebSocket::AmazonSsm
module PayloadType
Output = 1
Method connect_ssm_ws
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def connect_ssm_ws(session_init, timeout = 20)
# hack-up a "graceful fail-down" in the caller
# raise Rex::Proto::Http::WebSocket::ConnectionError.new(msg: 'WebSocket sessions still need structs/parsing')
ws_key = session_init.token_value
ssm_id = session_init.session_id
Method on_data_read
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def on_data_read(data, _data_type)
return data if data.blank?
ssm_frame = SsmFrame.read(data)
case ssm_frame.header.message_type.strip
Method to_ssm_channel
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def to_ssm_channel(publish_timeout: 10)
chan = SsmChannel.new(self)
if publish_timeout
# Waiting for the channel to start publishing
- 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"