Showing 110 of 152 total issues
Method run
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
elb = Aws::ElasticLoadBalancing::Client.new(aws_config)
begin
instance_health = elb.describe_instance_health(load_balancer_name: config[:load_balancer])
Method handle
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def handle
mail_to = build_mail_to_list
body = <<-BODY.gsub(/^\s+/, '')
#{@event['check']['output']}
Host: #{@event['client']['name']}
Method run
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
errors = []
@ec2 = Aws::EC2::Client.new
volumes = @ec2.describe_volumes(
Method run
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def run
# Subnets that meet the threshold criteria will store info hashes in this array
consumption_alert = []
begin
- Read upRead up
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 13 (exceeds 5 allowed). Consider refactoring. Open
def run
errors = []
@ec2 = Aws::EC2::Client.new
volumes = @ec2.describe_volumes(
- Read upRead up
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 13 (exceeds 5 allowed). Consider refactoring. Open
def run
errors = []
volume_filters = Filter.parse(config[:filter])
- Read upRead up
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 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
begin
client = Aws::EC2::Client.new(aws_config)
params = {
Method run
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
begin
cw = Aws::CloudWatch::Client.new(aws_config)
now = Time.now
r = cw.get_metric_statistics(
Method run
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
aws_regions = ec2_regions
@message = ''
critical = false
Method run
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
errors = []
warnings = []
buckets = if config[:all_buckets]
list_buckets
Method check_capacity
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def check_capacity(table)
config[:capacity_for].each do |r_or_w|
metric_name = "Consumed#{r_or_w.to_s.capitalize}CapacityUnits"
metric = cloud_watch_metric metric_name, table.table_name
metric_value = begin
- Read upRead up
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_sum_requests
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def check_sum_requests(elb)
metric = request_count_metric elb.load_balancer_name
metric_value = begin
latest_value metric
rescue StandardError
- Read upRead up
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 12 (exceeds 5 allowed). Consider refactoring. Open
def run
aws_region = config[:aws_region].nil? || config[:aws_region].empty? ? query_instance_region : config[:aws_region]
begin
elb = Fog::AWS::ELB.new aws_config
if config[:instances]
- Read upRead up
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_latency
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def check_latency(elb)
metric = latency_metric elb.load_balancer_name
metric_value = begin
latest_value metric
rescue StandardError
- Read upRead up
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 ec2_node_should_be_deleted?
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def ec2_node_should_be_deleted?
# Defining region for aws SDK object
ec2 = Aws::EC2::Client.new(region: region)
settings['ec2_node'] = {} unless settings['ec2_node']
instance_states = @event['client']['ec2_states'] || settings['ec2_node']['ec2_states'] || ['shutting-down', 'terminated', 'stopping', 'stopped']
- Read upRead up
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 composite_check
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def composite_check
numerator_metric_resp = get_metric(config[:numerator_metric_name])
denominator_metric_resp = get_metric(config[:denominator_metric_name])
## If the numerator is empty, then we see if there is a default. If there is a default
- Read upRead up
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_throttle
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def check_throttle(table)
config[:throttle_for].each do |r_or_w|
metric_name = "#{r_or_w.to_s.capitalize}ThrottleEvents"
metric = cloud_watch_metric metric_name, table.table_name
metric_value = begin
- Read upRead up
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 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
statistic_type = {
'CPUUtilization' => 'Average',
'DatabaseConnections' => 'Average',
'FreeStorageSpace' => 'Average',
Method maint_clusters
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def maint_clusters
maint_clusters = []
aws_regions = rds_regions
unless config[:aws_region].casecmp('all').zero?
Method run
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
aws_config = {}
if config[:use_iam_role].nil?
aws_config[:access_key_id] = config[:aws_access_key]
aws_config[:secret_access_key] = config[:aws_secret_access_key]