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.
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 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 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 retrieve_all_table_names
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def retrieve_all_table_names
tables = []
response = nil
loop do
options = {
- 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 wait_until_table_is_available
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def wait_until_table_is_available(full_table_name, delay = 5, max_attempts = 5)
puts "Waiting for Table #{full_table_name} to be available."
puts "Waiting with a #{delay} second delay between attempts, for a maximum of #{max_attempts} attempts."
max_time = Time.at(delay * max_attempts).utc.strftime('%H:%M:%S')
puts "Max waiting time will be: #{max_time} (approximate)."
- 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"