Showing 630 of 1,221 total issues
Method request
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def request(params)
refresh_credentials_if_expired
idempotent = params.delete(:idempotent)
parser = params.delete(:parser)
Method _request
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _request(scheme, host, port, params, original_params, &block)
connection(scheme, host, port).request(params, &block)
rescue Excon::Errors::MovedPermanently, Excon::Errors::TemporaryRedirect => error
headers = (error.response.is_a?(Hash) ? error.response[:headers] : error.response.headers)
new_params = {}
Method end_element
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def end_element(name)
case name
when 'member'
if @in_policy_attribute_types
@policy_type['PolicyAttributeTypeDescriptions'] << @policy_attribute_type_description
Method end_element
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def end_element(name)
case @configuration
when 'topic'
case name
when 'Id', 'Event', 'Topic'
Method create_cache_cluster
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_cache_cluster(id, options = {})
req_options = {
'Action' => 'CreateCacheCluster',
'CacheClusterId' => id.strip,
'CacheNodeType' => options[:node_type] || 'cache.m1.large',
Method create_cache_cluster
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_cache_cluster(id, options = {})
response = Excon::Response.new
cluster = { # create an in-memory representation of this cluster
'CacheClusterId' => id.strip,
'NumCacheNodes' => options[:num_nodes] || 1,
Method store_mock_object
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def store_mock_object(bucket, object_name, body, options)
object = {
:body => body,
'Content-Type' => options['Content-Type'],
'ETag' => OpenSSL::Digest::MD5.hexdigest(body),
Method set_load_balancer_policies_of_listener
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def set_load_balancer_policies_of_listener(lb_name, load_balancer_port, policy_names)
raise Fog::AWS::ELB::NotFound unless load_balancer = self.data[:load_balancers][lb_name]
policy_names = [*policy_names]
response = Excon::Response.new
Method create_load_balancer
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_load_balancer(availability_zones, lb_name, listeners, options = {})
params = Fog::AWS.indexed_param('AvailabilityZones.member', [*availability_zones])
params.merge!(Fog::AWS.indexed_param('Subnets.member.%d', options[:subnet_ids]))
params.merge!(Fog::AWS.serialize_keys('Scheme', options[:scheme]))
params.merge!(Fog::AWS.indexed_param('SecurityGroups.member.%d', options[:security_groups]))
Method create_load_balancer_listeners
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_load_balancer_listeners(lb_name, listeners)
load_balancer = data[:load_balancers][lb_name]
raise Fog::AWS::ELB::NotFound unless load_balancer
response = Excon::Response.new
Method put_object_acl
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def put_object_acl(bucket_name, object_name, acl, options = {})
query = {'acl' => nil}
if version_id = options.delete('versionId')
query['versionId'] = version_id
end
Method describe_tasks
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def describe_tasks(params={})
response = Excon::Response.new
response.status = 200
unless tasks = params.delete('tasks')
Consider simplifying this complex logical expression. Open
if @endpoint = options[:endpoint]
endpoint = URI.parse(@endpoint)
@host = endpoint.host or raise InvalidURIError.new("could not parse endpoint: #{@endpoint}")
@path = endpoint.path
@port = endpoint.port
Method _request
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def _request(method, path, query, body, headers, expects, idempotent, parser=nil)
Consider simplifying this complex logical expression. Open
if @endpoint = options[:endpoint]
endpoint = URI.parse(@endpoint)
@host = endpoint.host or raise InvalidURIError.new("could not parse endpoint: #{@endpoint}")
@path = endpoint.path
@port = endpoint.port
Consider simplifying this complex logical expression. Open
elsif options['IpPermissions']
options['IpPermissions'].each do |permission|
groups = (permission['Groups'] || []).map do |authorized_group|
security_group = if group_name = authorized_group['GroupName']
Method end_element
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def end_element(name)
case name
when 'CommonPrefixes'
@in_common_prefixes = false
when 'Contents'
- 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 9 (exceeds 5 allowed). Consider refactoring. Open
def end_element(name)
if @in_tag_set
case name
when 'item'
@internet_gateway['tagSet'][@tag['key']] = @tag['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 save
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def save
if identity
update_params = {
'Size' => self.size,
'Iops' => self.iops,
- 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 9 (exceeds 5 allowed). Consider refactoring. Open
def end_element(name)
if @in_attachment_set
case name
when 'attachmentSet'
@in_attachment_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"