Showing 630 of 1,221 total issues
Method update_rule
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def update_rule(rule_number, protocol, rule_action, cidr_block, egress, options = {})
Avoid deeply nested control flow statements. Open
Open
if ENV["AWS_ENDPOINT_URL_STS"]
ENV["AWS_ENDPOINT_URL_STS"]
elsif ENV["AWS_STS_REGIONAL_ENDPOINTS"] == "regional" && region
"https://sts.#{region}.amazonaws.com"
else
Avoid deeply nested control flow statements. Open
Open
case name
when 'StorageClass',
@version_transition['StorageClass'] = value
when 'Date'
@version_transition[name] = value
Avoid deeply nested control flow statements. Open
Open
elsif @in_ipv6_ranges
if @in_ip_permissions_egress
@ip_permission_egress['ipv6Ranges'] << @ipv6_range
else
@ip_permission['ipv6Ranges'] << @ipv6_range
Avoid deeply nested control flow statements. Open
Open
case name
when 'value'
@response['userData'] = value
when 'userData'
@in_userData = false
Avoid deeply nested control flow statements. Open
Open
case name
when 'architecture', 'description', 'hypervisor', 'imageId', 'imageLocation', 'imageOwnerAlias', 'imageOwnerId', 'imageState', 'imageType', 'kernelId', 'name', 'platform', 'ramdiskId', 'rootDeviceType','rootDeviceName','virtualizationType'
@image[name] = value
when 'isPublic','enaSupport'
if value == 'true'
Method end_element
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def end_element(name)
case name
when 'Name', 'Value'
@dimension[name] = value
when 'AlarmConfigurationUpdatedTimestamp', 'StateUpdatedTimestamp'
- 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
Open
while remaining > 0
chunk = data.read([remaining, Excon::CHUNK_SIZE].min)
block.call(chunk, remaining, total_bytes)
remaining -= Excon::CHUNK_SIZE
end
Avoid deeply nested control flow statements. Open
Open
elsif @in_disableApiTermination
case name
when 'value'
@response['disableApiTermination'] = (value == 'true')
when 'disableApiTermination'
Avoid deeply nested control flow statements. Open
Open
case name
when 'attachmentId', 'instanceId', 'instanceOwnerId', 'deviceIndex', 'status', 'attachTime', 'deleteOnTermination'
@attachment[name] = value
when 'attachment'
@response['attachment'] = @attachment
Avoid deeply nested control flow statements. Open
Open
case name
when 'associationId', 'publicIp', 'ipOwnerId'
@association[name] = value
when 'association'
@nic['association'] = @association
Avoid deeply nested control flow statements. Open
Open
case name
when 'volumeId', 'availabilityZone'
@volume[name] = value
when 'nextToken', 'requestId'
@response[name] = value
Avoid deeply nested control flow statements. Open
Open
elsif @in_private_ip_addresses
case name
when 'item'
if value
@private_ip_address['item'] = value.strip
Avoid deeply nested control flow statements. Open
Open
bucket[:objects].delete(object_name) if bucket[:objects][object_name].empty?
Method upload_part
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def upload_part(bucket_name, object_name, upload_id, part_number, data, options = {})
Avoid deeply nested control flow statements. Open
Open
elsif @in_blockDeviceMapping
case name
when 'item'
@response["blockDeviceMapping"] << @block_device_mapping
@block_device_mapping = {}
Avoid deeply nested control flow statements. Open
Open
if @in_ip_permissions_egress
@ip_permission_egress['ipRanges'] << @ip_range
else
@ip_permission['ipRanges'] << @ip_range
end
Avoid deeply nested control flow statements. Open
Open
case name
when 'requestId', 'networkInterfaceId'
@response[name] = value
end
Method upload_part
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def upload_part(bucket_name, object_name, upload_id, part_number, data, options = {})
Avoid deeply nested control flow statements. Open
Open
unless ranges.nil? || ranges.empty?
response.status = 206
body = body[ranges.first]
end