sensu-plugins/sensu-plugins-aws

View on GitHub

Showing 110 of 152 total issues

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

  def run
    event_instances = []
    aws_config = {}

    aws_regions = ec2_regions
Severity: Minor
Found in bin/check-instance-events.rb - About 6 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 39 (exceeds 5 allowed). Consider refactoring.
Open

  def run
    Aws.config.update(aws_config)
    sqs = Aws::SQS::Resource.new

    if config[:prefix].empty?
Severity: Minor
Found in bin/check-sqs-messages.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 32 (exceeds 5 allowed). Consider refactoring.
Open

  def run
    warning = 3
    critical = 4
    result_launched = ''
    result_terminated = ''
Severity: Minor
Found in bin/check-asg-instances-created.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 maint_clusters has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

  def maint_clusters
    maint_clusters = []
    aws_regions = rds_regions

    unless config[:aws_region].casecmp('all').zero?
Severity: Minor
Found in bin/check-rds-events.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 83 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def run
    # Subnets that meet the threshold criteria will store info hashes in this array
    consumption_alert = []

    begin
Severity: Major
Found in bin/check-subnet-ip-consumption.rb - About 3 hrs to fix

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

      def run
        warning = 0
        critical = 0
        result = ''
        if config[:load_balancer].nil?
    Severity: Minor
    Found in bin/check-elb-instances-inservice.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 23 (exceeds 5 allowed). Consider refactoring.
    Open

      def run
        aws_config = {}
    
        if (config[:key_name].nil? && config[:key_prefix].nil?) || (!config[:key_name].nil? && !config[:key_prefix].nil?)
          critical 'Need one option between "key_name" and "key_prefix"'
    Severity: Minor
    Found in bin/check-s3-object.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 23 (exceeds 5 allowed). Consider refactoring.
    Open

      def run
        ses = Aws::SES::Client.new(aws_config)
        begin
          response = ses.get_send_statistics
    
    
    Severity: Minor
    Found in bin/check-ses-statistics.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 22 (exceeds 5 allowed). Consider refactoring.
    Open

      def run
        errors = []
        warnings = []
        buckets = if config[:all_buckets]
                    list_buckets
    Severity: Minor
    Found in bin/check-s3-bucket-visibility.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 22 (exceeds 5 allowed). Consider refactoring.
    Open

      def run
        filters = Filter.parse(config[:filter])
        filters.push(
          name: 'instance-state-name',
          values: ['running']
    Severity: Minor
    Found in bin/check-ec2-cpu_balance.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
        ok_message = []
        warning_message = []
        critical_message = []
    
    
    Severity: Minor
    Found in bin/check-elb-certs.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 21 (exceeds 5 allowed). Consider refactoring.
    Open

      def run
        warning = 0
        critical = 0
        instance_in_service = 0
        result = ''
    Severity: Minor
    Found in bin/check-asg-instances-inservice.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

    File check-rds.rb has 288 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'sensu-plugin/check/cli'
    require 'aws-sdk'
    require 'time'
    
    class CheckRDS < Sensu::Plugin::Check::CLI
    Severity: Minor
    Found in bin/check-rds.rb - About 2 hrs to fix

      Method memory_total_bytes has 65 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def memory_total_bytes(instance_class)
          memory_total_gigabytes = {
            'db.cr1.8xlarge'  => 244.0,
            'db.m1.small'     => 1.7,
            'db.m1.medium'    => 3.75,
      Severity: Major
      Found in bin/check-rds.rb - About 2 hrs to fix

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

          def run
            aws_regions = ec2_regions
            @message = ''
            critical = false
        
        
        Severity: Minor
        Found in bin/check-elb-health-sdk.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 19 (exceeds 5 allowed). Consider refactoring.
        Open

          def run
            service_healths = services_by_health(config[:cluster_name], config[:services], config[:primary_status])
        
            unhealthy = []
            unhealthy.concat(service_healths[:critical]) if service_healths.key? :critical
        Severity: Minor
        Found in bin/check-ecs-service-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 62 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def run
            Aws.config.update(aws_config)
            sqs = Aws::SQS::Resource.new
        
            if config[:prefix].empty?
        Severity: Major
        Found in bin/check-sqs-messages.rb - About 2 hrs to fix

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

            def run
              # Converting the string into a hash.
              filter_list = config[:exclude_tags].split(/}\s?{/).map do |x|
                x.gsub(/[{}]/, '')
              end
          Severity: Major
          Found in bin/check-sensu-client.rb - About 2 hrs to fix

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

              def run
                filter_list = config[:exclude_tags].split(/}\s?{/).map do |x|
                  x.gsub(/[{}]/, '')
                end
                filter_list = filter_list.map do |y|
            Severity: Major
            Found in bin/check-ec2-filter.rb - About 2 hrs to fix

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

                def run
                  filter = Filter.parse(config[:filter])
                  options = if filter.empty?
                              {}
                            else
              Severity: Minor
              Found in bin/check-instance-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

              Severity
              Category
              Status
              Source
              Language