sensu-plugins/sensu-plugins-aws

View on GitHub

Showing 110 of 152 total issues

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

  def check_iops(severity, expected_lower_than)
    read_iops_metric ||= cloud_watch_metric 'ReadIOPS', 'Count/Second'
    read_iops_metric_value ||= latest_value read_iops_metric
    write_iops_metric ||= cloud_watch_metric 'WriteIOPS', 'Count/Second'
    write_iops_metric_value ||= latest_value write_iops_metric
Severity: Minor
Found in bin/check-rds.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

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

  def run
    client = Aws::CloudWatch::Client.new aws_config

    options = { alarm_names: [config[:name]] }
    data = client.describe_alarms(options)
Severity: Minor
Found in bin/check-cloudwatch-alarm.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

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

  def self.parse(input)
    filter = []

    if input == '{}'
      return filter
Severity: Minor
Found in lib/sensu-plugins-aws/filter.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

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

  def run
    client = Aws::CloudWatch::Client.new
    options = { state_value: config[:state] }
    alarms = client.describe_alarms(options).metric_alarms

Severity: Minor
Found in bin/check-cloudwatch-alarm-multi.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

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

  def check_memory(severity, expected_lower_than)
    memory_metric ||= cloud_watch_metric 'FreeableMemory', 'Bytes'
    memory_metric_value ||= latest_value memory_metric
    memory_total_bytes ||= memory_total_bytes @db_instance.db_instance_class
    memory_usage_bytes ||= memory_total_bytes - memory_metric_value
Severity: Minor
Found in bin/check-rds.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

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

  def run
    begin
      cw = Aws::CloudWatch::Client.new(aws_config)
      now = Time.now
      r = cw.get_metric_statistics(
Severity: Minor
Found in bin/metrics-billing.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

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

  def print_statistics(load_balancer_name, statistics)
    result = {}
    static_value = {}
    statistics.each do |key, static|
      r = cloud_watch_metric(key, static, load_balancer_name)
Severity: Minor
Found in bin/metrics-elb.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

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

  def run
    begin
      groupnames ||= config[:groupname] ? [config[:groupname]] : autoscaling_groups
      groupnames.each do |g|
        as = Aws::AutoScaling::AutoScalingGroup.new aws_config.merge!(name: g)
Severity: Minor
Found in bin/metrics-autoscaling-instance-count.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

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

  def check_disk(severity, expected_lower_than)
    disk_metric ||= cloud_watch_metric 'FreeStorageSpace', 'Bytes'
    disk_metric_value ||= latest_value disk_metric
    disk_total_bytes ||= @db_instance.allocated_storage * 1024**3
    disk_usage_bytes ||= disk_total_bytes - disk_metric_value
Severity: Minor
Found in bin/check-rds.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

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

  def instance_count
    client = Aws::AutoScaling::Client.new
    resp = client.describe_auto_scaling_groups(
      auto_scaling_group_names: [config[:groupname]]
    ).to_h
Severity: Minor
Found in bin/check-instances-count.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