Showing 630 of 1,221 total issues
Method create_route
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def create_route(route_table_id, destination_cidr_block, internet_gateway_id=nil, instance_id=nil, network_interface_id=nil)
instance_owner_id = nil
route_table = self.data[:route_tables].find { |routetable| routetable["routeTableId"].eql? route_table_id }
if !route_table.nil? && destination_cidr_block
if !internet_gateway_id.nil? || !instance_id.nil? || !network_interface_id.nil?
- 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 attach_volume
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def attach_volume(instance_id, volume_id, device)
response = Excon::Response.new
if instance_id && volume_id && device
response.status = 200
instance = self.data[:instances][instance_id]
- 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 end_element
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
def end_element(name)
case name
when 'DeleteMarker'
@response['Versions'] << {'DeleteMarker' => @delete_marker }
@delete_marker = { 'Owner' => {} }
Method run_instance_options
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run_instance_options
raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted?
requires :image_id
options = {
Method end_element
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
def end_element(name)
if @in_actions_set
case name
when 'actionsSet'
@in_actions_set = false
Method create_subnet
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_subnet(vpcId, cidrBlock, options = {})
av_zone = options['AvailabilityZone'].nil? ? 'us-east-1c' : options['AvailabilityZone']
Excon::Response.new.tap do |response|
if cidrBlock && vpcId
vpc = self.data[:vpcs].find{ |v| v['vpcId'] == vpcId }
Method data
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.data
@data ||= Hash.new do |hash, region|
hash[region] = Hash.new do |region_hash, key|
region_hash[key] = {
:clusters => {},
Method delete_object_helper
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def delete_object_helper(bucket, object_name, version_id)
response = { 'Deleted' => {} }
if bucket[:versioning]
bucket[:objects][object_name] ||= []
Method create_load_balancer
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_load_balancer(name, options = {})
response = Excon::Response.new
response.status = 200
raise Fog::AWS::ELBV2::IdentifierTaken if self.data[:load_balancers_v2].key? name
Method describe_db_instances
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
def describe_db_instances(identifier=nil, opts={})
response = Excon::Response.new
server_set = []
if identifier
if specified_server = self.data[:servers][identifier]
Method terminate_instances
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
def terminate_instances(instance_id)
response = Excon::Response.new
instance_id = [*instance_id]
if (self.data[:instances].keys & instance_id).length == instance_id.length
response.body = {
Method class_for
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.class_for(key)
case key
when :auto_scaling
Fog::AWS::AutoScaling
when :beanstalk
Method get
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def get(record_name, record_type = nil, record_identifier = nil)
requires :zone
# Append a trailing period to the record_name if absent.
record_name = record_name + "." unless record_name.end_with?(".")
record_type = record_type.upcase unless record_type.nil?
- 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 end_element
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def end_element(name)
if @in_expiration
case name
when 'Days'
@expiration[name] = value.to_i
- 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 encode_batch_attributes
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def encode_batch_attributes(items, replace_attributes = Hash.new([]))
encoded_attributes = {}
if items
item_index = 0
for item_key in items.keys
- 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 end_element
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def end_element(name)
if @in_actions_set
case name
when 'actionsSet'
@in_actions_set = false
- 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 end_element
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def end_element(name)
if @in_description
case name
when 'value'
@response['description'] = value
- 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 replace_network_acl_entry
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def replace_network_acl_entry(network_acl_id, rule_number, protocol, rule_action, cidr_block, egress, options = {})
response = Excon::Response.new
if self.data[:network_acls][network_acl_id]
unless self.data[:network_acls][network_acl_id]['entrySet'].find { |r| r['ruleNumber'] == rule_number && r['egress'] == egress }
- 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 describe_clusters
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def describe_clusters(params={})
response = Excon::Response.new
response.status = 200
members = params.delete('clusters')
- 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 batch_put_attributes
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def batch_put_attributes(domain_name, items, replace_attributes = Hash.new([]))
response = Excon::Response.new
if self.data[:domains][domain_name]
for item_name, attributes in items do
for key, value in attributes do
- 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"