Showing 630 of 1,221 total issues

Method create_route has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

        def create_route(route_table_id, destination_cidr_block, internet_gateway_id=nil, instance_id=nil, network_interface_id=nil)
          instance_owner_id = nil
          route_table = self.data[:route_tables].find { |routetable| routetable["routeTableId"].eql? route_table_id }
          if !route_table.nil? && destination_cidr_block
            if !internet_gateway_id.nil? || !instance_id.nil? || !network_interface_id.nil?
Severity: Minor
Found in lib/fog/aws/requests/compute/create_route.rb - About 2 hrs to fix

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_volume has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
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]
Severity: Minor
Found in lib/fog/aws/requests/compute/attach_volume.rb - About 2 hrs to fix

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 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

          def end_element(name)
            case name
            when 'DeleteMarker'
              @response['Versions'] << {'DeleteMarker' => @delete_marker }
              @delete_marker = { 'Owner' => {} }
Severity: Major
Found in lib/fog/aws/parsers/storage/get_bucket_object_versions.rb - About 2 hrs to fix

    Method run_instance_options has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def run_instance_options
              raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted?
              requires :image_id
    
              options = {
    Severity: Major
    Found in lib/fog/aws/models/compute/server.rb - About 2 hrs to fix

      Method end_element has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                def end_element(name)
                  if @in_actions_set
                    case name
                    when 'actionsSet'
                      @in_actions_set = false
      Severity: Major
      Found in lib/fog/aws/parsers/compute/describe_volume_status.rb - About 2 hrs to fix

        Method create_subnet has 52 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                def create_subnet(vpcId, cidrBlock, options = {})
                  av_zone = options['AvailabilityZone'].nil? ? 'us-east-1c' : options['AvailabilityZone']
                  Excon::Response.new.tap do |response|
                    if cidrBlock && vpcId
                      vpc = self.data[:vpcs].find{ |v| v['vpcId'] == vpcId }
        Severity: Major
        Found in lib/fog/aws/requests/compute/create_subnet.rb - About 2 hrs to fix

          Method data has 51 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|
                        region_hash[key] = {
                          :clusters            => {},
          Severity: Major
          Found in lib/fog/aws/rds.rb - About 2 hrs to fix

            Method delete_object_helper has 50 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    def delete_object_helper(bucket, object_name, version_id)
                      response = { 'Deleted' => {} }
                      if bucket[:versioning]
                        bucket[:objects][object_name] ||= []
            
            
            Severity: Minor
            Found in lib/fog/aws/requests/storage/delete_multiple_objects.rb - About 2 hrs to fix

              Method create_load_balancer has 50 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      def create_load_balancer(name, options = {})
                        response = Excon::Response.new
                        response.status = 200
              
                        raise Fog::AWS::ELBV2::IdentifierTaken if self.data[:load_balancers_v2].key? name
              Severity: Minor
              Found in lib/fog/aws/requests/elbv2/create_load_balancer.rb - About 2 hrs to fix

                Method describe_db_instances has 49 lines of code (exceeds 25 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]
                Severity: Minor
                Found in lib/fog/aws/requests/rds/describe_db_instances.rb - About 1 hr to fix

                  Method terminate_instances has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          def terminate_instances(instance_id)
                            response = Excon::Response.new
                            instance_id = [*instance_id]
                            if (self.data[:instances].keys & instance_id).length == instance_id.length
                              response.body = {
                  Severity: Minor
                  Found in lib/fog/aws/requests/compute/terminate_instances.rb - About 1 hr to fix

                    Method class_for has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          def self.class_for(key)
                            case key
                              when :auto_scaling
                                Fog::AWS::AutoScaling
                              when :beanstalk
                    Severity: Minor
                    Found in lib/fog/aws/service_mapper.rb - About 1 hr to fix

                      Method get has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                      Open

                              def get(record_name, record_type = nil, record_identifier = nil)
                                requires :zone
                                # Append a trailing period to the record_name if absent.
                                record_name = record_name + "." unless record_name.end_with?(".")
                                record_type = record_type.upcase unless record_type.nil?
                      Severity: Minor
                      Found in lib/fog/aws/models/dns/records.rb - About 1 hr to fix

                      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 15 (exceeds 5 allowed). Consider refactoring.
                      Open

                                def end_element(name)
                                  if @in_expiration
                                    case name
                                    when 'Days'
                                      @expiration[name] = value.to_i
                      Severity: Minor
                      Found in lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb - About 1 hr to fix

                      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 encode_batch_attributes has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                      Open

                              def encode_batch_attributes(items, replace_attributes = Hash.new([]))
                                encoded_attributes = {}
                                if items
                                  item_index = 0
                                  for item_key in items.keys
                      Severity: Minor
                      Found in lib/fog/aws/simpledb.rb - About 1 hr to fix

                      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 15 (exceeds 5 allowed). Consider refactoring.
                      Open

                                def end_element(name)
                                  if @in_actions_set
                                    case name
                                    when 'actionsSet'
                                      @in_actions_set = false
                      Severity: Minor
                      Found in lib/fog/aws/parsers/compute/describe_volume_status.rb - About 1 hr to fix

                      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 15 (exceeds 5 allowed). Consider refactoring.
                      Open

                                def end_element(name)
                                  if @in_description
                                    case name
                                    when 'value'
                                      @response['description'] = value
                      Severity: Minor
                      Found in lib/fog/aws/parsers/compute/describe_network_interface_attribute.rb - About 1 hr to fix

                      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 replace_network_acl_entry has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                      Open

                              def replace_network_acl_entry(network_acl_id, rule_number, protocol, rule_action, cidr_block, egress, options = {})
                                response = Excon::Response.new
                                if self.data[:network_acls][network_acl_id]
                      
                                  unless self.data[:network_acls][network_acl_id]['entrySet'].find { |r| r['ruleNumber'] == rule_number && r['egress'] == egress }
                      Severity: Minor
                      Found in lib/fog/aws/requests/compute/replace_network_acl_entry.rb - About 1 hr to fix

                      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_clusters has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                      Open

                              def describe_clusters(params={})
                                response = Excon::Response.new
                                response.status = 200
                      
                                members = params.delete('clusters')
                      Severity: Minor
                      Found in lib/fog/aws/requests/ecs/describe_clusters.rb - About 1 hr to fix

                      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 batch_put_attributes has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                      Open

                              def batch_put_attributes(domain_name, items, replace_attributes = Hash.new([]))
                                response = Excon::Response.new
                                if self.data[:domains][domain_name]
                                  for item_name, attributes in items do
                                    for key, value in attributes do
                      Severity: Minor
                      Found in lib/fog/aws/requests/simpledb/batch_put_attributes.rb - About 1 hr to fix

                      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

                      Severity
                      Category
                      Status
                      Source
                      Language