Showing 630 of 1,221 total issues

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

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

    Avoid deeply nested control flow statements.
    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
    Severity: Major
    Found in lib/fog/aws/credential_fetcher.rb - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                    case name
                    when 'StorageClass',
                      @version_transition['StorageClass'] = value
                    when 'Date'
                      @version_transition[name] = value
      Severity: Major
      Found in lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                        elsif @in_ipv6_ranges
                          if @in_ip_permissions_egress
                            @ip_permission_egress['ipv6Ranges'] << @ipv6_range
                          else
                            @ip_permission['ipv6Ranges'] << @ipv6_range
        Severity: Major
        Found in lib/fog/aws/parsers/compute/describe_security_groups.rb - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                        case name
                        when 'value'
                          @response['userData'] = value
                        when 'userData'
                          @in_userData = false
          Severity: Major
          Found in lib/fog/aws/parsers/compute/describe_instance_attribute.rb - About 45 mins to fix

            Avoid deeply nested control flow statements.
            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'
            Severity: Major
            Found in lib/fog/aws/parsers/compute/describe_images.rb - About 45 mins to fix

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

                        def end_element(name)
                          case name
                          when 'Name', 'Value'
                            @dimension[name] = value
                          when 'AlarmConfigurationUpdatedTimestamp', 'StateUpdatedTimestamp'
              Severity: Minor
              Found in lib/fog/aws/parsers/cloud_watch/describe_alarms.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

                                while remaining > 0
                                  chunk = data.read([remaining, Excon::CHUNK_SIZE].min)
                                  block.call(chunk, remaining, total_bytes)
                                  remaining -= Excon::CHUNK_SIZE
                                end
              Severity: Major
              Found in lib/fog/aws/requests/storage/get_object.rb - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                            elsif @in_disableApiTermination
                              case name
                              when 'value'
                                @response['disableApiTermination'] = (value == 'true')
                              when 'disableApiTermination'
                Severity: Major
                Found in lib/fog/aws/parsers/compute/describe_instance_attribute.rb - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                case name
                                when 'attachmentId', 'instanceId', 'instanceOwnerId', 'deviceIndex', 'status', 'attachTime', 'deleteOnTermination'
                                  @attachment[name] = value
                                when 'attachment'
                                  @response['attachment'] = @attachment
                  Severity: Major
                  Found in lib/fog/aws/parsers/compute/describe_network_interface_attribute.rb - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                  case name
                                  when 'associationId', 'publicIp', 'ipOwnerId'
                                    @association[name] = value
                                  when 'association'
                                    @nic['association'] = @association
                    Severity: Major
                    Found in lib/fog/aws/parsers/compute/network_interface_parser.rb - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                    case name
                                    when 'volumeId', 'availabilityZone'
                                      @volume[name] = value
                                    when 'nextToken', 'requestId'
                                      @response[name] = value
                      Severity: Major
                      Found in lib/fog/aws/parsers/compute/describe_volume_status.rb - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                    elsif @in_private_ip_addresses
                                      case name
                                      when 'item'
                                        if value
                                          @private_ip_address['item'] = value.strip
                        Severity: Major
                        Found in lib/fog/aws/parsers/compute/network_interface_parser.rb - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                            bucket[:objects].delete(object_name) if bucket[:objects][object_name].empty?
                          Severity: Major
                          Found in lib/fog/aws/requests/storage/delete_object.rb - About 45 mins to fix

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

                                    def upload_part(bucket_name, object_name, upload_id, part_number, data, options = {})
                            Severity: Minor
                            Found in lib/fog/aws/requests/storage/upload_part.rb - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                          elsif @in_blockDeviceMapping
                                            case name
                                            when 'item'
                                              @response["blockDeviceMapping"] << @block_device_mapping
                                              @block_device_mapping = {}
                              Severity: Major
                              Found in lib/fog/aws/parsers/compute/describe_image_attribute.rb - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                  if @in_ip_permissions_egress
                                                    @ip_permission_egress['ipRanges'] << @ip_range
                                                  else
                                                    @ip_permission['ipRanges'] << @ip_range
                                                  end
                                Severity: Major
                                Found in lib/fog/aws/parsers/compute/describe_security_groups.rb - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                case name
                                                when 'requestId', 'networkInterfaceId'
                                                  @response[name] = value
                                                end
                                  Severity: Major
                                  Found in lib/fog/aws/parsers/compute/describe_network_interface_attribute.rb - About 45 mins to fix

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

                                            def upload_part(bucket_name, object_name, upload_id, part_number, data, options = {})
                                    Severity: Minor
                                    Found in lib/fog/aws/requests/storage/upload_part.rb - About 45 mins to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                                        unless ranges.nil? || ranges.empty?
                                                          response.status = 206
                                                          body = body[ranges.first]
                                                        end
                                      Severity: Major
                                      Found in lib/fog/aws/requests/storage/get_object.rb - About 45 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language