sensu-plugins/sensu-plugins-elasticsearch

View on GitHub

Showing 53 of 69 total issues

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

  def kibana_info
    kibana_date_format = '%Y-%m-%dT%H:%M:%S.%LZ'
    unless config[:kibana_url].nil?
      index = config[:index]
      unless config[:date_index].nil?
Severity: Minor
Found in bin/check-es-query-average.rb - About 1 hr to fix

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

      def kibana_info
        kibana_date_format = '%Y-%m-%dT%H:%M:%S.%LZ'
        unless config[:kibana_url].nil?
          index = config[:index]
          unless config[:date_index].nil?
    Severity: Minor
    Found in bin/check-es-query-count.rb - About 1 hr to fix

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

        def run
          if client.exists?(build_request_options)
            if config[:invert]
              if config[:warn]
                warning
      Severity: Minor
      Found in bin/check-es-query-exists.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 get_es_resource has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def get_es_resource(resource)
          headers = {}
          if config[:user] && config[:password]
            auth = 'Basic ' + Base64.strict_encode64("#{config[:user]}:#{config[:password]}").chomp
            headers = { 'Authorization' => auth }
      Severity: Minor
      Found in bin/check-es-cluster-status.rb - About 1 hr to fix

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

          def run
            options = {}
            unless config[:level].nil?
              options[:level] = config[:level]
            end
        Severity: Minor
        Found in bin/check-es-cluster-health.rb - About 1 hr to fix

          Method acquire_es_resource has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def acquire_es_resource(resource)
              headers = {}
              if config[:user] && config[:password]
                auth = 'Basic ' + Base64.strict_encode64("#{config[:user]}:#{config[:password]}").chomp
                headers = { 'Authorization' => auth }
          Severity: Minor
          Found in bin/check-es-heap.rb - About 1 hr to fix

            Method get_es_resource has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def get_es_resource(resource)
                headers = {}
                if config[:user] && config[:password]
                  auth = 'Basic ' + Base64.strict_encode64("#{config[:user]}:#{config[:password]}").chomp
                  headers = { 'Authorization' => auth }
            Severity: Minor
            Found in bin/check-es-circuit-breakers.rb - About 1 hr to fix

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

                def run
                  response = client.count(build_request_options)
                  if config[:invert]
                    if response['count'] < config[:crit]
                      critical "Query count (#{response['count']}) was below critical threshold. #{kibana_info}"
              Severity: Minor
              Found in bin/check-es-query-count.rb - About 1 hr to fix

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

                  def run
                    response = client.search(build_request_options)
                    if config[:invert]
                      if response['aggregations']['average']['value'] < config[:crit]
                        critical "Query average (#{response['aggregations']['average']['value']}) was below critical threshold. #{kibana_info}"
                Severity: Minor
                Found in bin/check-es-query-average.rb - About 1 hr to fix

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

                    def run
                      # If only one cluster is given, no need to check the indexes
                      ok 'All indexes are unique' if config[:cluster].length == 1
                  
                      port = ':9200'
                  Severity: Minor
                  Found in bin/check-es-indexes.rb - About 1 hr to fix

                    Method acquire_es_resource has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def acquire_es_resource(resource)
                        headers = {}
                        if config[:user] && config[:password]
                          auth = 'Basic ' + Base64.strict_encode64("#{config[:user]}:#{config[:password]}").chomp
                          headers = { 'Authorization' => auth }
                    Severity: Minor
                    Found in bin/check-es-heap.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 get_es_resource has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def get_es_resource(resource)
                        headers = {}
                        if config[:user] && config[:password]
                          auth = 'Basic ' + Base64.strict_encode64("#{config[:user]}:#{config[:password]}").chomp
                          headers = { 'Authorization' => auth }
                    Severity: Minor
                    Found in bin/check-es-cluster-status.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 get_es_resource has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def get_es_resource(resource)
                        headers = {}
                        if config[:user] && config[:password]
                          auth = 'Basic ' + Base64.strict_encode64("#{config[:user]}:#{config[:password]}").chomp
                          headers = { 'Authorization' => auth }
                    Severity: Minor
                    Found in bin/metrics-es-node.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 breaker_status has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def breaker_status
                        breakers = {}
                        status = if config[:localhost]
                                   get_es_resource('/_nodes/_local/stats/breaker')
                                 else
                    Severity: Minor
                    Found in bin/check-es-circuit-breakers.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 get_es_resource has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def get_es_resource(resource)
                        headers = {}
                        if config[:user] && config[:password]
                          auth = 'Basic ' + Base64.strict_encode64("#{config[:user]}:#{config[:password]}").chomp
                          headers = { 'Authorization' => auth }
                    Severity: Minor
                    Found in bin/check-es-circuit-breakers.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 get_es_resource has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def get_es_resource(resource)
                        headers = {}
                        if config[:user] && config[:password]
                          auth = 'Basic ' + Base64.strict_encode64("#{config[:user]}:#{config[:password]}").chomp
                          headers = { 'Authorization' => auth }
                    Severity: Minor
                    Found in bin/check-es-file-descriptors.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 get_es_resource has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def get_es_resource(resource)
                        headers = {}
                        if config[:user] && config[:password]
                          auth = 'Basic ' + Base64.strict_encode64("#{config[:user]}:#{config[:password]}").chomp
                          headers = { 'Authorization' => auth }
                    Severity: Minor
                    Found in bin/metrics-es-cluster.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 get_es_resource has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def get_es_resource(resource)
                        headers = {}
                        if config[:user] && config[:password]
                          auth = 'Basic ' + Base64.strict_encode64("#{config[:user]}:#{config[:password]}").chomp
                          headers = { 'Authorization' => auth }
                    Severity: Minor
                    Found in bin/metrics-es-node-graphite.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 get_es_resource has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def get_es_resource(resource)
                        headers = {}
                        if config[:user] && config[:password]
                          auth = 'Basic ' + Base64.strict_encode64("#{config[:user]}:#{config[:password]}").chomp
                          headers = { 'Authorization' => auth }
                    Severity: Minor
                    Found in bin/check-es-node-status.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 get_es_resource has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def get_es_resource(resource)
                        headers = {}
                        if config[:user] && config[:password]
                          auth = 'Basic ' + Base64.strict_encode64("#{config[:user]}:#{config[:password]}").chomp
                          headers = { 'Authorization' => auth }
                    Severity: Minor
                    Found in bin/check-es-file-descriptors.rb - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language