Showing 630 of 1,221 total issues
Method describe_security_groups
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
def describe_security_groups(filters = {})
unless filters.is_a?(Hash)
Fog::Logger.deprecation("describe_security_groups with #{filters.class} param is deprecated, use describe_security_groups('group-name' => []) instead [light_black](#{caller.first})[/]")
filters = {'group-name' => [*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 list_all_records
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
def list_all_records(record, zone, name)
[].tap do |tmp_records|
tmp_records.push(record) if !record[:name].nil? && ( name.nil? || record[:name].gsub(zone[:name],"") >= name)
record.each do |key,subr|
if subr.is_a?(Hash) && key.is_a?(String) &&
- 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 digest_for_part
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def digest_for_part(body)
part_stack = []
part_temp = nil
body_size = body.bytesize
prepare_body_for_slice(body) {|body, slice|
Method modify_cluster
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def modify_cluster(options = {})
cluster_identifier = options[:cluster_identifier]
cluster_type = options[:cluster_type]
node_type = options[:node_type]
master_user_password = options[:master_user_password]
Method split_shard
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def split_shard(options={})
stream_name = options.delete("StreamName")
shard_id = options.delete("ShardToSplit")
stream = data[:kinesis_streams].detect{ |s| s["StreamName"] == stream_name }
Method receive_message
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def receive_message(queue_url, options = {})
Excon::Response.new.tap do |response|
if (queue = data[:queues][queue_url])
max_number_of_messages = options['MaxNumberOfMessages'] || 1
now = Time.now
Method create_db_cluster
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def create_db_cluster(cluster_name, options={})
response = Excon::Response.new
if self.data[:clusters][cluster_name]
raise Fog::AWS::RDS::IdentifierTaken.new("DBClusterAlreadyExists")
end
Method upload_server_certificate
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def upload_server_certificate(certificate, private_key, name, options = {})
if certificate.nil? || certificate.empty? || private_key.nil? || private_key.empty?
raise Fog::AWS::IAM::ValidationError.new
end
response = Excon::Response.new
Method update_service
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def update_service(params={})
response = Excon::Response.new
response.status = 200
service_id = params.delete('service')
Method attach_volume
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
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]
Method describe_volumes_modifications
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def describe_volumes_modifications(filters = {})
response = Excon::Response.new
modification_set = self.data[:volume_modifications].values
Method end_element
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def end_element(name)
if @in_description
case name
when 'value'
@response['description'] = value
Method merge_shards
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def merge_shards(options={})
stream_name = options.delete("StreamName")
shard_to_merge_id = options.delete("ShardToMerge")
adjacent_shard_to_merge_id = options.delete("AdjacentShardToMerge")
Method describe_tags
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def describe_tags(filters = {})
response = Excon::Response.new
tag_set = deep_clone(self.data[:tags])
Method create_auto_scaling_group
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def create_auto_scaling_group(auto_scaling_group_name, availability_zones, launch_configuration_name, max_size, min_size, options = {})
unexpected_options = options.keys - ExpectedOptions[:create_auto_scaling_group]
unless unexpected_options.empty?
raise Fog::AWS::AutoScaling::ValidationError.new("Options #{unexpected_options.join(',')} should not be included in request")
end
Method request
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def request(params)
refresh_credentials_if_expired
idempotent = params.delete(:idempotent)
parser = params.delete(:parser)
Method end_element
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def end_element(name)
if @in_tag_set
case name
when 'item'
@route_table['tagSet'][@tag['key']] = @tag['value']
Method put_bucket_notification
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def put_bucket_notification(bucket_name, notification)
builder = Nokogiri::XML::Builder.new do
NotificationConfiguration do
notification.fetch('Topics', []).each do |topic|
TopicConfiguration do
Method hash_to_acl
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def self.hash_to_acl(acl)
data = "<AccessControlPolicy>\n"
if acl['Owner'] && (acl['Owner']['ID'] || acl['Owner']['DisplayName'])
data << " <Owner>\n"
Method end_element
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def end_element(name)
case name
when 'availabilityZone', 'instanceTenancy', 'instanceType', 'offeringType', 'productDescription', 'reservedInstancesId', 'scope', 'state'
@reserved_instance[name] = value
when 'duration', 'instanceCount'