Showing 630 of 1,221 total issues

Method invoke has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def invoke(params={})
          response = Excon::Response.new
          response.status = 200
          response.body = ''

Severity: Minor
Found in lib/fog/aws/requests/lambda/invoke.rb - About 45 mins 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

Avoid deeply nested control flow statements.
Open

                    zone[:records][change[:type]][change_name] = {} if zone[:records][change[:type]][change_name].nil?
Severity: Major
Found in lib/fog/aws/requests/dns/change_resource_record_sets.rb - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                      action_performed = true unless zone[:records][change[:type]].delete(change_name).nil?
    Severity: Major
    Found in lib/fog/aws/requests/dns/change_resource_record_sets.rb - About 45 mins to fix

      Method _request has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              def _request(scheme, host, port, params, original_params, &block)
      Severity: Minor
      Found in lib/fog/aws/storage.rb - About 45 mins to fix

        Consider simplifying this complex logical expression.
        Open

                    if change_item[:alias_target]
                      # Accept either underscore or camel case for hash keys.
                      dns_name = change_item[:alias_target][:dns_name] || change_item[:alias_target][:DNSName]
                      hosted_zone_id = change_item[:alias_target][:hosted_zone_id] || change_item[:alias_target][:HostedZoneId] || AWS.hosted_zone_for_alias_target(dns_name)
                      evaluate_target_health = change_item[:alias_target][:evaluate_target_health] || change_item[:alias_target][:EvaluateTargetHealth] || false
        Severity: Major
        Found in lib/fog/aws/dns.rb - About 40 mins to fix

          Consider simplifying this complex logical expression.
          Open

                      if (full_msg_error.has_key?('Message') || full_msg_error.has_key?('message')) &&
                          (error.response.headers.has_key?('x-amzn-ErrorType') || full_msg_error.has_key?('__type'))
                        matched_error = {
                          :code    => full_msg_error['__type'] || error.response.headers['x-amzn-ErrorType'].split(':').first,
                          :message => full_msg_error['Message'] || full_msg_error['message']
          Severity: Major
          Found in lib/fog/aws/errors.rb - About 40 mins to fix

            Consider simplifying this complex logical expression.
            Open

                      if availability_zone && (size || options['SnapshotId'])
                        snapshot = self.data[:snapshots][options['SnapshotId']]
                        if options['SnapshotId'] && !snapshot
                          raise Fog::AWS::Compute::NotFound.new("The snapshot '#{options['SnapshotId']}' does not exist.")
                        end
            Severity: Major
            Found in lib/fog/aws/requests/compute/create_volume.rb - About 40 mins to fix

              Consider simplifying this complex logical expression.
              Open

                        if ((instance && address) || (instance &&  !params[:allocation_id].nil?) || (!params[:allocation_id].nil? && !network_interface_id.nil?))
                          if !params[:allocation_id].nil?
                            allocation_ip = describe_addresses( 'allocation-id'  => "#{params[:allocation_id]}").body['addressesSet'].first
                            if !allocation_ip.nil?
                              public_ip = allocation_ip['publicIp']
              Severity: Major
              Found in lib/fog/aws/requests/compute/associate_address.rb - About 40 mins to fix

                Method update_inbound_rule has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        def update_inbound_rule(rule_number, protocol, rule_action, cidr_block, options = {})
                Severity: Minor
                Found in lib/fog/aws/models/compute/network_acl.rb - About 35 mins to fix

                  Method update_outbound_rule has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                          def update_outbound_rule(rule_number, protocol, rule_action, cidr_block, options = {})
                  Severity: Minor
                  Found in lib/fog/aws/models/compute/network_acl.rb - About 35 mins to fix

                    Method add_inbound_rule has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                            def add_inbound_rule(rule_number, protocol, rule_action, cidr_block, options = {})
                    Severity: Minor
                    Found in lib/fog/aws/models/compute/network_acl.rb - About 35 mins to fix

                      Method add_outbound_rule has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                              def add_outbound_rule(rule_number, protocol, rule_action, cidr_block, options = {})
                      Severity: Minor
                      Found in lib/fog/aws/models/compute/network_acl.rb - About 35 mins to fix

                        Method _request has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                                def _request(body, headers, idempotent, parser, retries = 0)
                        Severity: Minor
                        Found in lib/fog/aws/compute.rb - About 35 mins to fix

                          Method _request has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                                  def _request(body, headers, idempotent, parser, path)
                          Severity: Minor
                          Found in lib/fog/aws/sqs.rb - About 35 mins to fix

                            Method upload_part_copy has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                    def upload_part_copy(target_bucket_name, target_object_name, upload_id, part_number, options = {})
                            Severity: Minor
                            Found in lib/fog/aws/requests/storage/upload_part_copy.rb - About 35 mins to fix

                              Method upload_part_copy has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                      def upload_part_copy(target_bucket_name, target_object_name, upload_id, part_number, options = {})
                              Severity: Minor
                              Found in lib/fog/aws/requests/storage/upload_part_copy.rb - About 35 mins to fix

                                Method copy_object has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                        def copy_object(source_bucket_name, source_object_name, target_bucket_name, target_object_name, options = {})
                                Severity: Minor
                                Found in lib/fog/aws/requests/storage/copy_object.rb - About 35 mins to fix

                                  Method copy_object has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                          def copy_object(source_bucket_name, source_object_name, target_bucket_name, target_object_name, options = {})
                                  Severity: Minor
                                  Found in lib/fog/aws/requests/storage/copy_object.rb - About 35 mins to fix

                                    Method assume_role has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                    Open

                                            def assume_role(role_session_name, role_arn, external_id=nil, policy=nil, duration=3600)
                                    Severity: Minor
                                    Found in lib/fog/aws/requests/sts/assume_role.rb - About 35 mins to fix

                                      Method create_route has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                      Open

                                              def create_route(route_table_id, destination_cidr_block, internet_gateway_id=nil, instance_id=nil, network_interface_id=nil)
                                      Severity: Minor
                                      Found in lib/fog/aws/requests/compute/create_route.rb - About 35 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language