sensu-plugins/sensu-plugins-rabbitmq

View on GitHub

Showing 49 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 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 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 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 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 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

      Similar blocks of code found in 5 locations. Consider refactoring.
      Open

        def node_fd
          pfd = node_info[:pfd]
      
          output = {}
      
      
      Severity: Major
      Found in bin/check-rabbitmq-node-usage.rb and 4 other locations - About 1 hr to fix
      bin/check-rabbitmq-node-usage.rb on lines 187..203
      bin/check-rabbitmq-node-usage.rb on lines 206..222
      bin/check-rabbitmq-node-usage.rb on lines 244..260
      bin/check-rabbitmq-node-usage.rb on lines 263..279

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 66.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 5 locations. Consider refactoring.
      Open

        def node_proc
          pproc = node_info[:pproc]
      
          output = {}
      
      
      Severity: Major
      Found in bin/check-rabbitmq-node-usage.rb and 4 other locations - About 1 hr to fix
      bin/check-rabbitmq-node-usage.rb on lines 187..203
      bin/check-rabbitmq-node-usage.rb on lines 206..222
      bin/check-rabbitmq-node-usage.rb on lines 225..241
      bin/check-rabbitmq-node-usage.rb on lines 263..279

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 66.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 5 locations. Consider refactoring.
      Open

        def node_disk
          pdisk = node_info[:pdisk]
      
          output = {}
      
      
      Severity: Major
      Found in bin/check-rabbitmq-node-usage.rb and 4 other locations - About 1 hr to fix
      bin/check-rabbitmq-node-usage.rb on lines 187..203
      bin/check-rabbitmq-node-usage.rb on lines 206..222
      bin/check-rabbitmq-node-usage.rb on lines 225..241
      bin/check-rabbitmq-node-usage.rb on lines 244..260

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 66.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 5 locations. Consider refactoring.
      Open

        def node_socket
          psocket = node_info[:psocket]
      
          output = {}
      
      
      Severity: Major
      Found in bin/check-rabbitmq-node-usage.rb and 4 other locations - About 1 hr to fix
      bin/check-rabbitmq-node-usage.rb on lines 187..203
      bin/check-rabbitmq-node-usage.rb on lines 225..241
      bin/check-rabbitmq-node-usage.rb on lines 244..260
      bin/check-rabbitmq-node-usage.rb on lines 263..279

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 66.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 5 locations. Consider refactoring.
      Open

        def node_mem
          pmem = node_info[:pmem]
      
          output = {}
      
      
      Severity: Major
      Found in bin/check-rabbitmq-node-usage.rb and 4 other locations - About 1 hr to fix
      bin/check-rabbitmq-node-usage.rb on lines 206..222
      bin/check-rabbitmq-node-usage.rb on lines 225..241
      bin/check-rabbitmq-node-usage.rb on lines 244..260
      bin/check-rabbitmq-node-usage.rb on lines 263..279

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 66.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      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

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

              if config[:regex]
                if config[:queue] && config[:exclude]
                  next unless queue['name'] =~ /#{queue_list.first}/ && queue['name'] !~ /#{exclude_list.first}/
                else
                  next unless queue['name'] =~ /#{queue_list.first}/
      Severity: Major
      Found in bin/check-rabbitmq-consumers.rb and 1 other location - About 1 hr to fix
      bin/check-rabbitmq-consumer-utilisation.rb on lines 93..103

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 64.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Severity
      Category
      Status
      Source
      Language