Showing 630 of 1,221 total issues
Method describe_instances
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def describe_instances(filters = {})
unless filters.is_a?(Hash)
Fog::Logger.deprecation("describe_instances with #{filters.class} param is deprecated, use describe_instances('instance-id' => []) instead [light_black](#{caller.first})[/]")
filters = {'instance-id' => [*filters]}
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
Method delete_service
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def delete_service(params={})
response = Excon::Response.new
response.status = 200
service_id = params.delete('service')
- 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 create_mount_target
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def create_mount_target(file_system_id, subnet_id, options={})
response = Excon::Response.new
default_security_group = mock_compute.data[:security_groups].find do |_, sg|
sg['groupDescription'] == 'default_elb security group'
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
Method list_policy_versions
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def list_policy_versions(policy_arn, options={})
limit = options['MaxItems']
marker = options['Marker']
if limit
- 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 save
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def save
requires :image_id, :flavor_id, :price
options = {
'AvailabilityZoneGroup' => availability_zone_group,
Method match_error
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.match_error(error)
if !Fog::AWS.json_response?(error.response)
matchers = [
lambda {|s| s.match(/(?:.*<Code>(.*)<\/Code>)(?:.*<Message>(.*)<\/Message>)/m)},
lambda {|s| s.match(/.*<(.+Exception)>(?:.*<Message>(.*)<\/Message>)/m)}
Method save
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def save
requires :alarm_name
requires :comparison_operator
requires :evaluation_periods
requires :metric_name
Method start_element
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def start_element(name, attrs = [])
super
case name
when 'ListenerDescriptions'
@in_listeners = true
Method end_element
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def end_element(name)
if @in_tag_set
case name
when 'item'
@snapshot['tagSet'][@tag['key']] = @tag['value']
Method end_element
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def end_element(name)
case name
#Simple closers
when 'instanceId', 'availabilityZone'
@instance[name] = value
Method describe_cache_security_groups
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def describe_cache_security_groups(name = nil, opts={})
if name
sec_group_set = [self.data[:security_groups][name]].compact
raise Fog::AWS::Elasticache::NotFound.new("Security Group #{name} not found") if sec_group_set.empty?
else
Method create_queue
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_queue(name, options = {})
Excon::Response.new.tap do |response|
response.status = 200
now = Time.now
Method describe_instance_attribute
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def describe_instance_attribute(instance_id, attribute)
response = Excon::Response.new
if instance = self.data[:instances].values.find{ |i| i['instanceId'] == instance_id }
response.status = 200
response.body = {
Method create_db_snapshot
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_db_snapshot(identifier, name)
response = Excon::Response.new
if data[:snapshots][name]
raise Fog::AWS::RDS::IdentifierTaken.new
end
Method describe_route_tables
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def describe_route_tables(filters = {})
unless filters.is_a?(Hash)
Fog::Logger.deprecation("describe_route_tables with #{filters.class} param is deprecated, use describe_route_tables('route-table-id' => []) instead [light_black](#{caller.first})[/]")
filters = {'route-table-id' => [*filters]}
end
Method describe_image_attribute
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def describe_image_attribute(image_id, attribute)
response = Excon::Response.new
if image = self.data[:images].values.find{ |i| i['imageId'] == image_id }
response.status = 200
response.body = {
Method create_db_cluster_snapshot
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_db_cluster_snapshot(identifier, name)
response = Excon::Response.new
if data[:cluster_snapshots][name]
raise Fog::AWS::RDS::IdentifierTaken.new
Method deregister_container_instance
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def deregister_container_instance(params={})
response = Excon::Response.new
response.status = 200
instance_id = params.delete('containerInstance')
Method delete_cluster
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def delete_cluster(params={})
response = Excon::Response.new
response.status = 200
cluster_id = params.delete('cluster')
Method create_launch_configuration
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_launch_configuration(image_id, instance_type, launch_configuration_name, options = {})
if self.data[:launch_configurations].key?(launch_configuration_name)
raise Fog::AWS::AutoScaling::IdentifierTaken.new("Launch Configuration by this name already exists - A launch configuration already exists with the name #{launch_configuration_name}")
end
self.data[:launch_configurations][launch_configuration_name] = {