sensu-plugins/sensu-plugins-rabbitmq

View on GitHub

Showing 28 of 49 total issues

Method run has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

  def run
    # create arrays to hold failures
    queue_list = queue_list_builder(config[:queue])
    exclude_list = queue_list_builder(config[:exclude])
    missing = if config[:regex]
Severity: Minor
Found in bin/check-rabbitmq-consumer-utilisation.rb - About 5 hrs 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 run has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

  def run
    queue_list = queue_list_builder(config[:queue])
    exclude_list = queue_list_builder(config[:exclude])
    # create arrays to hold failures
    missing = if config[:regex]
Severity: Minor
Found in bin/check-rabbitmq-consumers.rb - About 5 hrs 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 run has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

  def run
    rabbitmq = acquire_rabbitmq_info

    # monitor counts in each queue or monitor the total number of messages in the system
    if config[:queuelevel]
Severity: Minor
Found in bin/check-rabbitmq-messages.rb - About 4 hrs 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 run has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

  def run
    timestamp = Time.now.to_i
    acquire_rabbitmq_info(:queues).each do |queue|
      # The queue might be reported by the API but its metrics somehow
      # "corrupted". In this case, it doesn't have the ``backing_queue_status``
Severity: Minor
Found in bin/metrics-rabbitmq-queue.rb - About 3 hrs 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 generate_output has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

  def generate_output
    if @crit.empty? && @warn.empty?
      ok
    elsif !@crit.empty?
      @message_output = "\n" + 'critical:' + "\n" + @crit.join("\n") if config[:pretty]
Severity: Minor
Found in bin/check-rabbitmq-queue.rb - About 3 hrs 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 run has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

  def run
    @crit = []
    @warn = []
    rabbitmq = acquire_rabbitmq_info
    queues = rabbitmq.method_missing('queues/' + config[:vhost])
Severity: Minor
Found in bin/check-rabbitmq-queue.rb - About 2 hrs 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 run has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

  def run
    timestamp = Time.now.to_i
    acquire_rabbitmq_info(:exchanges).each do |exchange|
      if config[:filter]
        next unless exchange['name'].match(config[:filter])
Severity: Minor
Found in bin/metrics-rabbitmq-exchange.rb - About 2 hrs 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 node_healthy? has 66 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def node_healthy?
    host       = config[:host]
    port       = config[:port]
    username   = config[:username]
    password   = config[:password]
Severity: Major
Found in bin/check-rabbitmq-node-health.rb - About 2 hrs to fix

    Method run has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

      def run
        @crits = []
    
        queues = get_queues config
    
    
    Severity: Minor
    Found in bin/check-rabbitmq-queues-synchronised.rb - About 2 hrs 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 node_healthy? has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

      def node_healthy?
        host       = config[:host]
        port       = config[:port]
        username   = config[:username]
        password   = config[:password]
    Severity: Minor
    Found in bin/check-rabbitmq-node-health.rb - About 2 hrs 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 cluster_healthy? has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

      def cluster_healthy?
        host        = config[:host]
        port        = config[:port]
        ssl         = config[:ssl]
        verify_ssl  = config[:verify_ssl_off]
    Severity: Minor
    Found in bin/check-rabbitmq-cluster-health.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 run has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

      def run #rubocop:disable all
        timestamp = Time.now.to_i
    
        rabbitmq = acquire_rabbitmq_info
        overview = rabbitmq.overview
    Severity: Minor
    Found in bin/metrics-rabbitmq-overview.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 cluster_healthy? has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def cluster_healthy?
        host        = config[:host]
        port        = config[:port]
        ssl         = config[:ssl]
        verify_ssl  = config[:verify_ssl_off]
    Severity: Minor
    Found in bin/check-rabbitmq-cluster-health.rb - About 1 hr to fix

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

        def run
          warn_queues = {}
          crit_queues = {}
      
          acquire_rabbitmq_queues.each do |queue|
      Severity: Minor
      Found in bin/check-rabbitmq-queue-drain-time.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 vhost_alive? has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def vhost_alive?
          if config[:ini]
            ini = IniFile.load(config[:ini])
            section = ini['auth']
            username = section['username']
      Severity: Minor
      Found in bin/check-rabbitmq-stomp-alive.rb - About 1 hr to fix

        Method vhost_alive? has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def vhost_alive?
            host           = config[:host]
            port           = config[:port]
            vhost          = config[:vhost]
            ssl            = config[:ssl]
        Severity: Minor
        Found in bin/check-rabbitmq-amqp-alive.rb - About 1 hr to fix

          Method run has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def run
              queue_list = queue_list_builder(config[:queue])
              exclude_list = queue_list_builder(config[:exclude])
              # create arrays to hold failures
              missing = if config[:regex]
          Severity: Minor
          Found in bin/check-rabbitmq-consumers.rb - About 1 hr to fix

            Method run has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def run
                # create arrays to hold failures
                queue_list = queue_list_builder(config[:queue])
                exclude_list = queue_list_builder(config[:exclude])
                missing = if config[:regex]
            Severity: Minor
            Found in bin/check-rabbitmq-consumer-utilisation.rb - About 1 hr to fix

              Method assign_alerts has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                def assign_alerts(queue_name, total)
                  if config[:below]
                    @crit << "#{queue_name}:#{total}" if total <= config[:critical].to_i
                    @warn << "#{queue_name}:#{total}" if total <= config[:warn].to_i && total > config[:critical].to_i
                  else
              Severity: Minor
              Found in bin/check-rabbitmq-queue.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 add_common_options has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      def add_common_options
                        option :host,
                               description: 'RabbitMQ management API host',
                               long: '--host HOST',
                               default: 'localhost'
              Severity: Minor
              Found in lib/sensu-plugins-rabbitmq/rabbitmq.rb - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language