ManageIQ/manageiq-messaging

View on GitHub

Showing 9 of 21 total issues

Method subscribe_background_job_impl has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

        def subscribe_background_job_impl(options)
          queue_name, headers = queue_for_subscribe(options)

          subscribe(queue_name, headers) do |msg|
            begin
Severity: Minor
Found in lib/manageiq/messaging/stomp/background_job.rb - About 1 hr 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 subscribe_background_job_impl has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def subscribe_background_job_impl(options)
          queue_name, headers = queue_for_subscribe(options)

          subscribe(queue_name, headers) do |msg|
            begin
Severity: Minor
Found in lib/manageiq/messaging/stomp/background_job.rb - About 1 hr to fix

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 rdkafka_connection_opts has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

        def rdkafka_connection_opts(options)
          hosts = Array(options[:hosts] || options[:host])
          hosts.collect! { |host| "#{host}:#{options[:port]}" }

          result = {:"bootstrap.servers" => hosts.join(',')}
Severity: Minor
Found in lib/manageiq/messaging/kafka/client.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 initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def initialize(sender, message, payload, headers, ack_ref, client)
Severity: Minor
Found in lib/manageiq/messaging/received_message.rb - About 45 mins to fix

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

Method decode_body has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def decode_body(headers, raw_body)
        return raw_body unless headers.kind_of?(Hash)
        case headers["encoding"] || headers[:encoding]
        when "json"
          JSON.parse(raw_body)
Severity: Minor
Found in lib/manageiq/messaging/common.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

Method initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def initialize(options)
          host = options.slice(:host, :port, :ssl)
          host[:passcode] = options[:password] if options[:password]
          host[:login] = options[:username] if options[:username]

Severity: Minor
Found in lib/manageiq/messaging/stomp/client.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

Method queue_for_publish has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def queue_for_publish(options)
          affinity = options[:affinity] || 'none'
          address = "queue/#{options[:service]}.#{affinity}"

          headers = {:"destination-type" => 'ANYCAST', :persistent => true}
Severity: Minor
Found in lib/manageiq/messaging/stomp/common.rb - About 25 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

Severity
Category
Status
Source
Language