Showing 630 of 1,221 total issues
Method update_service
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def update_service(params={})
response = Excon::Response.new
response.status = 200
service_id = params.delete('service')
- 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 attach_classic_link_vpc
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def attach_classic_link_vpc(instance_id, vpc_id, security_group_ids, dry_run=false)
response = Excon::Response.new
vpc = self.data[:vpcs].find{ |v| v['vpcId'] == vpc_id }
instance = self.data[:instances][instance_id]
if vpc && instance
- 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_attached_user_policies
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def list_attached_user_policies(user_name, options={})
unless self.data[:users].key?(user_name)
raise Fog::AWS::IAM::NotFound.new("The user with name #{user_name} cannot be found.")
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_attached_role_policies
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def list_attached_role_policies(role_name, options={})
unless self.data[:roles].key?(role_name)
raise Fog::AWS::IAM::NotFound.new("The role with name #{role_name} cannot be found.")
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_resource_record_sets
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def list_resource_record_sets(zone_id, options = {})
maxitems = [options[:max_items]||100,100].min
response = Excon::Response.new
- 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 start_element
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def start_element(name, attrs = [])
super
case name
when 'PendingModifiedValues'
@in_pending_modified_values = true
Method end_element
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def end_element(name)
if @section == :resource_record_set
case name
when 'Type', 'TTL', 'SetIdentifier', 'Weight', 'Region', 'HealthCheckId', 'Failover'
@resource_record_set[name] = value
Method modify_network_interface_attribute
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def modify_network_interface_attribute(network_interface_id, attribute, value)
response = Excon::Response.new
if self.data[:network_interfaces][network_interface_id]
nic = self.data[:network_interfaces][network_interface_id]
Method modify_volume
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def modify_volume(volume_id, options={})
response = Excon::Response.new
volume = self.data[:volumes][volume_id]
if volume["volumeType"] == 'standard' && options['VolumeType']
Method delete_service
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def delete_service(params={})
response = Excon::Response.new
response.status = 200
service_id = params.delete('service')
Method authorize_security_group_ingress
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def authorize_security_group_ingress(group_name, options = {})
options = Fog::AWS.parse_security_group_options(group_name, options)
group = if options.key?('GroupName')
self.data[:security_groups].values.find { |v| v['groupName'] == options['GroupName'] }
Method authorize_security_group_egress
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def authorize_security_group_egress(group_name, options = {})
options = Fog::AWS.parse_security_group_options(group_name, options)
group = if options.key?('GroupName')
self.data[:security_groups].values.find { |v| v['groupName'] == options['GroupName'] }
Method create_event_source_mapping
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_event_source_mapping(params={})
enabled = params.delete('Enabled') || false
batch_size = params.delete('BatchSize') || 100
event_source_arn = params.delete('EventSourceArn')
function_name = params.delete('FunctionName')
Method list_policy_versions
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def list_policy_versions(policy_arn, options={})
limit = options['MaxItems']
marker = options['Marker']
if limit
Method describe_services
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def describe_services(params={})
response = Excon::Response.new
response.status = 200
cluster = params.delete('cluster') || 'default'
Consider simplifying this complex logical expression. Open
elsif ENV["AWS_WEB_IDENTITY_TOKEN_FILE"]
params = {
:Action => "AssumeRoleWithWebIdentity",
:RoleArn => options[:role_arn] || ENV.fetch("AWS_ROLE_ARN"),
:RoleSessionName => options[:role_session_name] || ENV["AWS_ROLE_SESSION_NAME"] || "fog-aws-#{SecureRandom.hex}",
Consider simplifying this complex logical expression. Open
elsif bucket = self.data[:buckets][bucket_name]
# We need to order results by S3 key, but since our data store is key => [versions], we want to ensure the integrity
# of the versions as well. So, sort the keys, then fetch the versions, and then combine them all as a sorted list by
# flattening the results.
contents = bucket[:objects].keys.sort.map { |key| bucket[:objects][key] }.flatten.reject do |object|
Method end_element
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def end_element(name)
case name
when 'CommonPrefixes'
@in_common_prefixes = false
when 'Contents'
Method _request
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _request(body, headers, idempotent, parser, retries = 0)
max_retries = 10
begin
Method delete_multiple_objects
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def delete_multiple_objects(bucket_name, object_names, options = {})
headers = options.dup
data = "<Delete>"
data << "<Quiet>true</Quiet>" if headers.delete(:quiet)
version_ids = headers.delete('versionId')