sensu-plugins/sensu-plugins-kubernetes

View on GitHub

Showing 14 of 19 total issues

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

  def run
    services = parse_list(config[:service_list])
    failed_services = []
    s = client.get_services
    # TODO: come back and clean me up
Severity: Minor
Found in bin/check-kube-service-available.rb - About 1 day 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 46 (exceeds 5 allowed). Consider refactoring.
Open

  def run
    pods_list = []
    failed_pods = []
    pods = []
    if config[:pod_filter].nil?
Severity: Minor
Found in bin/check-kube-pods-running.rb - About 7 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 36 (exceeds 5 allowed). Consider refactoring.
Open

  def run
    pods_list = []
    restarted_pods = []
    pods = []
    if config[:pod_filter].nil?
Severity: Minor
Found in bin/check-kube-pods-restarting.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 36 (exceeds 5 allowed). Consider refactoring.
Open

  def run
    pods_list = []
    failed_pods = []
    pods = []
    if config[:pod_filter].nil?
Severity: Minor
Found in bin/check-kube-pods-pending.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 kubeclient has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

        def kubeclient(options = {})
          raise(ArgumentError, 'options must be a hash') unless options.is_a?(Hash)

          if options[:kube_config]
            begin
Severity: Minor
Found in lib/sensu-plugins-kubernetes/client.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 28 (exceeds 5 allowed). Consider refactoring.
Open

  def run
    pods_list = []
    pods = []
    warn = false
    crit = false
Severity: Minor
Found in bin/check-kube-pods-runtime.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 kubeclient has 67 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def kubeclient(options = {})
          raise(ArgumentError, 'options must be a hash') unless options.is_a?(Hash)

          if options[:kube_config]
            begin
Severity: Major
Found in lib/sensu-plugins-kubernetes/client.rb - About 2 hrs to fix

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

      def run
        failed_nodes = []
        client.get_nodes.each do |node|
          item = node.status.conditions.detect { |condition| condition.type == 'Ready' }
          if item.nil?
    Severity: Minor
    Found in bin/check-kube-nodes-ready.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 50 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def run
        services = parse_list(config[:service_list])
        failed_services = []
        s = client.get_services
        # TODO: come back and clean me up
    Severity: Minor
    Found in bin/check-kube-service-available.rb - About 2 hrs to fix

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

        def run
          pods_list = []
          pods = []
          warn = false
          crit = false
      Severity: Minor
      Found in bin/check-kube-pods-runtime.rb - About 1 hr to fix

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

          def run
            pods_list = []
            failed_pods = []
            pods = []
            if config[:pod_filter].nil?
        Severity: Minor
        Found in bin/check-kube-pods-running.rb - About 1 hr to fix

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

            def run
              pods_list = []
              restarted_pods = []
              pods = []
              if config[:pod_filter].nil?
          Severity: Minor
          Found in bin/check-kube-pods-restarting.rb - About 1 hr to fix

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

              def run
                pods_list = []
                failed_pods = []
                pods = []
                if config[:pod_filter].nil?
            Severity: Minor
            Found in bin/check-kube-pods-pending.rb - About 1 hr to fix

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

                def ready?(pod)
                  failed = true
                  pod.status.conditions.each do |c|
                    if c.type == 'Ready'
                      failed = false if c.status == 'True'
              Severity: Minor
              Found in bin/check-kube-pods-running.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