Showing 26 of 26 total issues
File dynamo_db_manager.rb
has 276 lines of code (exceeds 250 allowed). Consider refactoring. Open
module LambdaWrap
# The DynamoTable class simplifies Creation, Updating, and Destroying Dynamo DB Tables.
# @since 1.0
class DynamoTable < AwsService
# Sets up the DynamoTable for the Dynamo DB Manager. Preloading the configuration in the constructor.
Method initialize
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def initialize(options)
defaults = {
description: 'Deployed with LambdaWrap', subnet_ids: [], security_group_ids: [], timeout: 30, memory_size: 128,
delete_unreferenced_versions: true, dead_letter_queue_arn: ''
}
- 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 initialize
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def initialize(name, variables = {}, description = 'Managed by LambdaWrap')
raise ArgumentError, 'name must be provided (String)!' unless name && name.is_a?(String)
# Max Alias Name length is 20 characters.
raise ArgumentError, "Invalid name format: #{name}" unless /^[a-zA-Z0-9\-\_]{3,20}$/ =~ name
@name = name
- 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
Class DynamoTable
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class DynamoTable < AwsService
# Sets up the DynamoTable for the Dynamo DB Manager. Preloading the configuration in the constructor.
#
# @param [Hash] options The configuration for the DynamoDB Table.
# @option options [String] :table_name The name of the DynamoDB Table. A "Base Name" can be used here where the
Method initialize
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(options)
defaults = {
description: 'Deployed with LambdaWrap', subnet_ids: [], security_group_ids: [], timeout: 30, memory_size: 128,
delete_unreferenced_versions: true, dead_letter_queue_arn: ''
}
Method delete
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def delete
if dynamo_tables.empty? && lambdas.empty? && api_gateways.empty?
puts 'Nothing to Deleting.'
return
end
- 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
Consider simplifying this complex logical expression. Open
unless options[:lambda_client] && options[:dynamo_client] && options[:api_gateway_client]
access_key_id = options[:access_key_id] || ENV['AWS_ACCESS_KEY_ID'] || ENV['ACCESS_KEY'] ||
raise(ArgumentError, 'Cannot find AWS Access Key ID.')
secret_access_key = options[:secret_access_key] || ENV['AWS_SECRET_ACCESS_KEY'] || ENV['SECRET_KEY'] ||
Method deploy
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def deploy(environment_options)
environment_parameter_guard(environment_options)
if no_op?
puts 'Nothing to deploy.'
return
- 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 teardown
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def teardown(environment_options)
environment_parameter_guard(environment_options)
if no_op?
puts 'Nothing to teardown.'
return
- 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 initialize
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(options)
default_options = { append_environment_on_deploy: false, read_capacity_units: 1, write_capacity_units: 1,
local_secondary_indexes: nil, global_secondary_indexes: nil,
attribute_definitions: [{ attribute_name: 'Id', attribute_type: 'S' }],
key_schema: [{ attribute_name: 'Id', key_type: 'HASH' }] }
Method build_global_index_updates_array
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def build_global_index_updates_array(current_global_indexes)
indexes_to_update = []
return indexes_to_update if current_global_indexes.empty?
current_global_indexes.each do |current_index|
@global_secondary_indexes.each do |target_index|
- 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 deploy
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def deploy(environment_options)
environment_parameter_guard(environment_options)
if no_op?
puts 'Nothing to deploy.'
return
Method teardown
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def teardown(environment_options)
environment_parameter_guard(environment_options)
if no_op?
puts 'Nothing to teardown.'
return
Method delete
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def delete
if dynamo_tables.empty? && lambdas.empty? && api_gateways.empty?
puts 'Nothing to Deleting.'
return
end
Method deploy
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def deploy(environment_options, client, region = 'AWS_REGION')
super
puts "Deploying API: #{@api_name} to Environment: #{environment_options.name}"
@stage_variables = environment_options.variables || {}
@stage_variables.store('environment', environment_options.name)
Method initialize
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def initialize(options)
default_options = { append_environment_on_deploy: false, read_capacity_units: 1, write_capacity_units: 1,
local_secondary_indexes: nil, global_secondary_indexes: nil,
attribute_definitions: [{ attribute_name: 'Id', attribute_type: 'S' }],
key_schema: [{ attribute_name: 'Id', key_type: 'HASH' }] }
- 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 update_table
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def update_table(full_table_name, table_details)
# Determine if Provisioned Throughput needs to be updated.
if @read_capacity_units != table_details.provisioned_throughput.read_capacity_units &&
@write_capacity_units != table_details.provisioned_throughput.write_capacity_units
- 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 get_id_for_api
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_id_for_api(api_name)
response = nil
loop do
options = {
limit: 500
- 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 deploy
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def deploy(environment_options, client, region = 'AWS_REGION')
super
puts "Deploying API: #{@api_name} to Environment: #{environment_options.name}"
@stage_variables = environment_options.variables || {}
@stage_variables.store('environment', environment_options.name)
- 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 deploy
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def deploy(environment_options, client, region = 'AWS_REGION')
super
puts "Deploying Table: #{@table_name} to Environment: #{environment_options.name}"
- 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"