Showing 630 of 1,221 total issues
Method fetch_credentials
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def fetch_credentials(options)
if options[:use_iam_profile] && Fog.mocking?
return Fog::AWS::Compute::Mock.data[:iam_role_based_creds]
end
if options[:use_iam_profile]
- 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 run_instances
has 112 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run_instances(image_id, min_count, max_count, options = {})
response = Excon::Response.new
response.status = 200
group_set = [ (options['SecurityGroup'] || 'default') ].flatten
Method end_element
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def end_element(name)
if @context.last == 'BootstrapActions'
case name
when 'Name'
@bootstrap_actions[name] = 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
Class LoadBalancer
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
class LoadBalancer < Fog::Model
identity :id, :aliases => 'LoadBalancerName'
attribute :availability_zones, :aliases => 'AvailabilityZones'
attribute :created_at, :aliases => 'CreatedTime'
attribute :dns_name, :aliases => 'DNSName'
Method end_element
has 108 lines of code (exceeds 25 allowed). Consider refactoring. Open
def end_element(name)
case name
when 'LatestRestorableTime', 'InstanceCreateTime'
@db_instance[name] = Time.parse value
Method create_load_balancer
has 107 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_load_balancer(availability_zones, lb_name, listeners = [], options = {})
response = Excon::Response.new
response.status = 200
raise Fog::AWS::ELB::IdentifierTaken if self.data[:load_balancers].key? lb_name
Method end_element
has 106 lines of code (exceeds 25 allowed). Consider refactoring. Open
def end_element(name)
if @in_instanceType
case name
when 'value'
@response['instanceType'] = value
Method data
has 105 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|
owner_id = Fog::AWS::Mock.owner_id
security_group_id = Fog::AWS::Mock.security_group_id
Method create_db_instance
has 104 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_db_instance(db_name, options={})
response = Excon::Response.new
if self.data[:servers] and self.data[:servers][db_name]
# I don't know how to raise an exception that contains the excon data
#response.status = 400
Method create_network_interface
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def create_network_interface(subnetId, options = {})
response = Excon::Response.new
if subnetId
subnet = self.data[:subnets].find{ |s| s['subnetId'] == subnetId }
if subnet.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 26 (exceeds 5 allowed). Consider refactoring. Open
def end_element(name)
case name
when 'LatestRestorableTime', 'InstanceCreateTime'
@db_instance[name] = Time.parse 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 describe_db_instances
has a Cognitive Complexity of 26 (exceeds 5 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]
- 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_bucket_object_versions
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def get_bucket_object_versions(bucket_name, options = {})
delimiter, key_marker, max_keys, prefix, version_id_marker = \
options['delimiter'], options['key-marker'], options['max-keys'],options['prefix'],options['version-id-marker']
unless bucket_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 delete_security_group
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def delete_security_group(name, id = nil)
if name == 'default'
raise Fog::AWS::Compute::Error.new("InvalidGroup.Reserved => The security group 'default' is reserved")
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 create_health_check
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def create_health_check(ip_address, port, type, options = {})
version = @version
builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|
xml.CreateHealthCheckRequest(:xmlns => "https://route53.amazonaws.com/doc/#{version}/") do
xml.CallerReference options[:caller_reference] || "#{Time.now.to_i.to_s}-#{SecureRandom.hex(6)}"
- 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 request_params
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def request_params(params)
headers = params[:headers] || {}
if params[:scheme]
scheme = params[:scheme]
- 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 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
def end_element(name)
if @context.last == 'BootstrapActions'
case name
when 'Name'
@bootstrap_actions[name] = value
Method end_element
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
def end_element(name)
case name
when 'amiLaunchIndex'
@instance[name] = value.to_i
when 'arn'
Method end_element
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def end_element(name)
case name
when 'ChangeSetId', 'ChangeSetName', 'Description', 'ExecutionStatus', 'StackId', 'StackName', 'StatusReason', 'Status'
@response[name] = value
when 'CreationTime'
- 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 hash_to_acl
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def self.hash_to_acl(acl)
data = "<AccessControlPolicy>\n"
if acl['Owner'] && (acl['Owner']['ID'] || acl['Owner']['DisplayName'])
data << " <Owner>\n"
- 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"