Showing 630 of 1,221 total issues

Avoid deeply nested control flow statements.
Open

                  case key
                  when 'Cache-Control', 'Content-Disposition', 'Content-Encoding', 'Content-Length', 'Content-MD5', 'Content-Type', 'ETag', 'Expires', 'Last-Modified', /^x-amz-meta-/
                    response.headers[key] = value
                  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

                      response.headers['x-amz-delete-marker'] = 'true' if version[:delete_marker]
    Severity: Major
    Found in lib/fog/aws/requests/storage/delete_object.rb - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                    case name
                    when 'group', 'userId'
                      @response['launchPermission'] << value
                    when 'launchPermission'
                      @in_launchPermission = false
      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

                      case name
                      when 'code', 'message'
                        @state_reason[name] = value
                      when 'stateReason'
                        @image['stateReason'] = @state_reason
        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
                      #Simple closers
                      when 'instanceId', 'availabilityZone'
                        @instance[name] = value
          Severity: Minor
          Found in lib/fog/aws/parsers/compute/describe_instance_status.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

          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 'Period', 'EvaluationPeriods'
          Severity: Minor
          Found in lib/fog/aws/parsers/cloud_watch/describe_alarms_for_metric.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

                        case name
                        when 'volumeStatus'
                          @volume['volumeStatus'] = @volume_status
                          @volume_status = { 'details' => [] }
                          @in_volume_status = false
          Severity: Major
          Found in lib/fog/aws/parsers/compute/describe_volume_status.rb - About 45 mins to fix

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

                    def create_change_set(stack_name, options = {})
                      params = {
                        'StackName' => stack_name,
                      }
            
            
            Severity: Minor
            Found in lib/fog/aws/requests/cloud_formation/create_change_set.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

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

                    def describe_orderable_db_instance_options(engine=nil, opts={})
                      instance_options = []
                      response = Excon::Response.new
                      if engine
                        (opts[:db_instance_class] || %w(db.m2.xlarge db.m1.large)).each do |size|
            Severity: Minor
            Found in lib/fog/aws/requests/rds/describe_orderable_db_instance_options.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

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

                    def register_image(name, description, location, block_devices=[], options={})
                      common_options = {
                        'Action'      => 'RegisterImage',
                        'Name'        => name,
                        'Description' => description,
            Severity: Minor
            Found in lib/fog/aws/requests/compute/register_image.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

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

                    def put_bucket_logging(bucket_name, logging_status)
                      if logging_status['LoggingEnabled'].empty?
                        data =
            <<-DATA
            <BucketLoggingStatus xmlns="http://doc.s3.amazonaws.com/2006-03-01" />
            Severity: Minor
            Found in lib/fog/aws/requests/storage/put_bucket_logging.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

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

                    def upload_part(vault_name, upload_id, body, offset, hash, options={})
            Severity: Minor
            Found in lib/fog/aws/requests/glacier/upload_part.rb - About 45 mins to fix

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

                      def describe_image_attribute(image_id, attribute)
                        response = Excon::Response.new
                        if image = self.data[:images].values.find{ |i| i['imageId'] == image_id }
                          response.status = 200
                          response.body = {
              Severity: Minor
              Found in lib/fog/aws/requests/compute/describe_image_attribute.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

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

                      def copy_object(source_bucket_name, source_object_name, target_bucket_name, target_object_name, options = {})
                        response = Excon::Response.new
                        source_bucket = self.data[:buckets][source_bucket_name]
                        source_object = source_bucket && source_bucket[:objects][source_object_name] && source_bucket[:objects][source_object_name].first
                        target_bucket = self.data[:buckets][target_bucket_name]
              Severity: Minor
              Found in lib/fog/aws/requests/storage/copy_object.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

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

                      def delete_db_instance(identifier, snapshot_identifier, skip_snapshot = false)
                        response = Excon::Response.new
              
              
                        server_set = self.data[:servers][identifier] ||
              Severity: Minor
              Found in lib/fog/aws/requests/rds/delete_db_instance.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

                                if self.data[:domains][domain_name][item_name][key]
                                  if value.nil? || value.empty?
                                    self.data[:domains][domain_name][item_name].delete(key)
                                  else
                                    for v in value
              Severity: Major
              Found in lib/fog/aws/requests/simpledb/delete_attributes.rb - About 45 mins to fix

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

                        def create_auto_scaling_group(auto_scaling_group_name, availability_zones, launch_configuration_name, max_size, min_size, options = {})
                Severity: Minor
                Found in lib/fog/aws/requests/auto_scaling/create_auto_scaling_group.rb - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                    if vpc['enableDnsHostnames']
                                      instance['dnsName'] = Fog::AWS::Mock.dns_name_for(public_ip)
                                    end
                  Severity: Major
                  Found in lib/fog/aws/requests/compute/associate_address.rb - About 45 mins to fix

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

                            def create_auto_scaling_group(auto_scaling_group_name, availability_zones, launch_configuration_name, max_size, min_size, options = {})
                    Severity: Minor
                    Found in lib/fog/aws/requests/auto_scaling/create_auto_scaling_group.rb - About 45 mins to fix

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

                              def describe_snapshots(filters = {}, options = {})
                                unless filters.is_a?(Hash)
                                  Fog::Logger.deprecation("describe_snapshots with #{filters.class} param is deprecated, use describe_snapshots('snapshot-id' => []) instead [light_black](#{caller.first})[/]")
                                  filters = {'snapshot-id' => [*filters]}
                                end
                      Severity: Minor
                      Found in lib/fog/aws/requests/compute/describe_snapshots.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

                      Severity
                      Category
                      Status
                      Source
                      Language