lib/manageiq/messaging/stomp/queue.rb
Method subscribe_messages_impl
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
def subscribe_messages_impl(options)
queue_name, headers = queue_for_subscribe(options)
# for STOMP we can get message one at a time
subscribe(queue_name, headers) do |msg|
- Read upRead up
- Create a ticketCreate a ticket
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 publish_message_impl
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def publish_message_impl(options, &block)
address, headers = queue_for_publish(options)
headers[:sender] = options[:sender] if options[:sender]
headers[:message_type] = options[:message] if options[:message]
headers[:class_name] = options[:class_name] if options[:class_name]
- Read upRead up
- Create a ticketCreate a ticket
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
Check block argument explicitly instead of using block_given?
. Open
Open
return unless block_given?
- Create a ticketCreate a ticket
- Exclude checks
Check block argument explicitly instead of using block_given?
. Open
Open
headers[:correlation_id] = Time.now.to_i.to_s if block_given?
- Create a ticketCreate a ticket
- Exclude checks