Showing 630 of 1,221 total issues
Method modify_image_attribute
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def modify_image_attribute(image_id, attributes)
raise ArgumentError.new("image_id is required") unless image_id
unless self.data[:images][image_id]
raise Fog::AWS::Compute::NotFound.new("The AMI ID '#{image_id}' does not exist")
- 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 update_event_source_mapping
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def update_event_source_mapping(params={})
mapping_id = params.delete('UUID')
mapping = self.data[:event_source_mappings][mapping_id]
unless mapping
- 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 verify_permission_options
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def verify_permission_options(options, is_vpc)
if options.size <= 1
raise Fog::AWS::Compute::Error.new("InvalidRequest => The request received was invalid.")
end
if !is_vpc && options['IpProtocol'] && !['tcp', 'udp', 'icmp'].include?(options['IpProtocol'])
- 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
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def _request(body, headers, idempotent, parser, method, path, expects)
Method replace_network_acl_entry
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def replace_network_acl_entry(network_acl_id, rule_number, protocol, rule_action, cidr_block, egress, options = {})
Method replace_network_acl_entry
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def replace_network_acl_entry(network_acl_id, rule_number, protocol, rule_action, cidr_block, egress, options = {})
Method create_network_acl_entry
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_network_acl_entry(network_acl_id, rule_number, protocol, rule_action, cidr_block, egress, options = {})
Method create_network_acl_entry
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_network_acl_entry(network_acl_id, rule_number, protocol, rule_action, cidr_block, egress, options = {})
Avoid deeply nested control flow statements. Open
if region.nil?
connection = options[:metadata_connection] || Excon.new(INSTANCE_METADATA_HOST)
token_header = fetch_credentials_token_header(connection, options[:disable_imds_v2])
region = connection.get(:path => INSTANCE_METADATA_AZ, :idempotent => true, :expects => 200, :headers => token_header).body[0..-2]
end
Method add_rule
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_rule(rule_number, protocol, rule_action, cidr_block, egress, options = {})
Avoid deeply nested control flow statements. Open
@configuration_endpoint[name] = value ? value.strip : name
Avoid deeply nested control flow statements. Open
case name
when 'member'
@response['Stacks'] << @stack
@stack = { 'Outputs' => [], 'Parameters' => [], 'Capabilities' => [], 'Tags' => []}
when 'RequestId'
Method get
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def get(namespace, metric_name, dimensions=nil, period=nil, statistic=nil, unit=nil)
Avoid deeply nested control flow statements. Open
case name
when 'ID', 'Prefix'
@rule[name] = value
when 'Status'
@rule['Enabled'] = value == 'Enabled'
Method munge
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def munge(data)
data.reduce([]) { |m,e|
policy_attribute_descriptions = e["PolicyAttributeDescriptions"]
policy = {
- 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
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _request(params)
response = @connection.request(params)
unless response.body.empty?
response.body = Fog::JSON.decode(response.body)
- 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 upload_in_threads
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def upload_in_threads(target_directory_key, target_file_key, upload_id, pending, completed, thread_count)
Method save
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def save
requires :id
requires :listeners
# with the VPC release, the ELB can have either availability zones or subnets
# if both are specified, the availability zones have preference
- 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
Avoid deeply nested control flow statements. Open
if replace_attributes[item_key].include?(attribute_key)
encoded_attributes["Item.#{item_index}.Attribute.#{attribute_index}.Replace"] = 'true'
end
Avoid deeply nested control flow statements. Open
case name
when 'member'
@stack['Capabilities'] << value
when 'Capabilities'
@in_capabilities = false