Showing 630 of 1,221 total issues

Method describe_security_groups has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

        def describe_security_groups(filters = {})
          unless filters.is_a?(Hash)
            Fog::Logger.deprecation("describe_security_groups with #{filters.class} param is deprecated, use describe_security_groups('group-name' => []) instead [light_black](#{caller.first})[/]")
            filters = {'group-name' => [*filters]}
          end
Severity: Minor
Found in lib/fog/aws/requests/compute/describe_security_groups.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 list_all_records has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

        def list_all_records(record, zone, name)
          [].tap do |tmp_records|
            tmp_records.push(record) if !record[:name].nil? && ( name.nil? || record[:name].gsub(zone[:name],"") >= name)
            record.each do |key,subr|
              if subr.is_a?(Hash) && key.is_a?(String) &&
Severity: Minor
Found in lib/fog/aws/requests/dns/list_resource_record_sets.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 digest_for_part has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def digest_for_part(body)
          part_stack = []
          part_temp = nil
          body_size = body.bytesize
          prepare_body_for_slice(body) {|body, slice|
Severity: Minor
Found in lib/fog/aws/glacier.rb - About 1 hr to fix

    Method modify_cluster has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def modify_cluster(options = {})
              cluster_identifier                  = options[:cluster_identifier]
              cluster_type                        = options[:cluster_type]
              node_type                           = options[:node_type]
              master_user_password                = options[:master_user_password]
    Severity: Minor
    Found in lib/fog/aws/requests/redshift/modify_cluster.rb - About 1 hr to fix

      Method split_shard has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def split_shard(options={})
                stream_name = options.delete("StreamName")
                shard_id = options.delete("ShardToSplit")
                stream = data[:kinesis_streams].detect{ |s| s["StreamName"] == stream_name }
      
      
      Severity: Minor
      Found in lib/fog/aws/requests/kinesis/split_shard.rb - About 1 hr to fix

        Method receive_message has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                def receive_message(queue_url, options = {})
                  Excon::Response.new.tap do |response|
                    if (queue = data[:queues][queue_url])
                      max_number_of_messages = options['MaxNumberOfMessages'] || 1
                      now = Time.now
        Severity: Minor
        Found in lib/fog/aws/requests/sqs/receive_message.rb - About 1 hr to fix

          Method create_db_cluster has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  def create_db_cluster(cluster_name, options={})
                    response = Excon::Response.new
                    if self.data[:clusters][cluster_name]
                      raise Fog::AWS::RDS::IdentifierTaken.new("DBClusterAlreadyExists")
                    end
          Severity: Minor
          Found in lib/fog/aws/requests/rds/create_db_cluster.rb - About 1 hr to fix

            Method upload_server_certificate has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    def upload_server_certificate(certificate, private_key, name, options = {})
                      if certificate.nil? || certificate.empty? || private_key.nil? || private_key.empty?
                        raise Fog::AWS::IAM::ValidationError.new
                      end
                      response = Excon::Response.new
            Severity: Minor
            Found in lib/fog/aws/requests/iam/upload_server_certificate.rb - About 1 hr to fix

              Method update_service has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

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

                Method attach_volume has 39 lines of code (exceeds 25 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 1 hr to fix

                  Method describe_volumes_modifications has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          def describe_volumes_modifications(filters = {})
                            response = Excon::Response.new
                  
                            modification_set = self.data[:volume_modifications].values
                  
                  
                  Severity: Minor
                  Found in lib/fog/aws/requests/compute/describe_volumes_modifications.rb - About 1 hr to fix

                    Method end_element has 38 lines of code (exceeds 25 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

                      Method merge_shards has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              def merge_shards(options={})
                                stream_name = options.delete("StreamName")
                                shard_to_merge_id = options.delete("ShardToMerge")
                                adjacent_shard_to_merge_id = options.delete("AdjacentShardToMerge")
                      
                      
                      Severity: Minor
                      Found in lib/fog/aws/requests/kinesis/merge_shards.rb - About 1 hr to fix

                        Method describe_tags has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                def describe_tags(filters = {})
                                  response = Excon::Response.new
                        
                                  tag_set = deep_clone(self.data[:tags])
                        
                        
                        Severity: Minor
                        Found in lib/fog/aws/requests/compute/describe_tags.rb - About 1 hr to fix

                          Method create_auto_scaling_group has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  def create_auto_scaling_group(auto_scaling_group_name, availability_zones, launch_configuration_name, max_size, min_size, options = {})
                                    unexpected_options = options.keys - ExpectedOptions[:create_auto_scaling_group]
                                    unless unexpected_options.empty?
                                      raise Fog::AWS::AutoScaling::ValidationError.new("Options #{unexpected_options.join(',')} should not be included in request")
                                    end
                          Severity: Minor
                          Found in lib/fog/aws/requests/auto_scaling/create_auto_scaling_group.rb - About 1 hr to fix

                            Method request has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    def request(params)
                                      refresh_credentials_if_expired
                            
                                      idempotent   = params.delete(:idempotent)
                                      parser       = params.delete(:parser)
                            Severity: Minor
                            Found in lib/fog/aws/lambda.rb - About 1 hr to fix

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

                                        def end_element(name)
                                          if @in_tag_set
                                            case name
                                              when 'item'
                                                @route_table['tagSet'][@tag['key']] = @tag['value']
                              Severity: Minor
                              Found in lib/fog/aws/parsers/compute/create_route_table.rb - About 1 hr to fix

                                Method put_bucket_notification has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                        def put_bucket_notification(bucket_name, notification)
                                          builder = Nokogiri::XML::Builder.new do
                                            NotificationConfiguration do
                                              notification.fetch('Topics', []).each do |topic|
                                                TopicConfiguration do
                                Severity: Minor
                                Found in lib/fog/aws/requests/storage/put_bucket_notification.rb - About 1 hr to fix

                                  Method hash_to_acl has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                          def self.hash_to_acl(acl)
                                            data =  "<AccessControlPolicy>\n"
                                  
                                            if acl['Owner'] && (acl['Owner']['ID'] || acl['Owner']['DisplayName'])
                                              data << "  <Owner>\n"
                                  Severity: Minor
                                  Found in lib/fog/aws/requests/storage/acl_utils.rb - About 1 hr to fix

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

                                              def end_element(name)
                                                case name
                                                when 'availabilityZone', 'instanceTenancy', 'instanceType', 'offeringType', 'productDescription', 'reservedInstancesId', 'scope', 'state'
                                                  @reserved_instance[name] = value
                                                when 'duration', 'instanceCount'
                                    Severity: Minor
                                    Found in lib/fog/aws/parsers/compute/describe_reserved_instances.rb - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language