ManageIQ/manageiq-messaging

View on GitHub
lib/manageiq/messaging/stomp/queue.rb

Summary

Maintainability
A
1 hr
Test Coverage
F
54%

Method subscribe_messages_impl has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
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|
Severity: Minor
Found in lib/manageiq/messaging/stomp/queue.rb - About 55 mins to fix

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

        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]
Severity: Minor
Found in lib/manageiq/messaging/stomp/queue.rb - About 35 mins to fix

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

          return unless block_given?

Check block argument explicitly instead of using block_given?.
Open

          headers[:correlation_id] = Time.now.to_i.to_s if block_given?

There are no issues that match your filters.

Category
Status