sensu-plugins/sensu-plugins-rabbitmq

View on GitHub

Showing 28 of 49 total issues

Method vhost_alive? has 28 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-alive.rb - About 1 hr to fix

    Method acquire_rabbitmq_info has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def acquire_rabbitmq_info(property = nil)
              begin
                if config[:ini]
                  ini = IniFile.load(config[:ini])
                  section = ini['auth']
    Severity: Minor
    Found in lib/sensu-plugins-rabbitmq/rabbitmq.rb - About 1 hr to fix

      Method run has 28 lines of code (exceeds 25 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

        Method run has 26 lines of code (exceeds 25 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 1 hr to fix

          Method return_condition has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def return_condition(missing, critical, warning)
              if critical.count > 0 || missing.count > 0
                message = []
                message << "Queues in critical state: #{critical.join(', ')}. " if critical.count > 0
                message << "Queues missing: #{missing.join(', ')}" if missing.count > 0
          Severity: Minor
          Found in bin/check-rabbitmq-consumer-utilisation.rb - About 45 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 return_condition has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def return_condition(missing, critical, warning)
              if critical.count > 0 || missing.count > 0
                message = []
                message << "Queues in critical state: #{critical.join(', ')}. " if critical.count > 0
                message << "Queues missing: #{missing.join(', ')}" if missing.count > 0
          Severity: Minor
          Found in bin/check-rabbitmq-consumers.rb - About 45 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 acquire_rabbitmq_info has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                  def acquire_rabbitmq_info(property = nil)
                    begin
                      if config[:ini]
                        ini = IniFile.load(config[:ini])
                        section = ini['auth']
          Severity: Minor
          Found in lib/sensu-plugins-rabbitmq/rabbitmq.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 vhost_alive? has a Cognitive Complexity of 6 (exceeds 5 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 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