Showing 630 of 1,221 total issues

Method request has 27 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/ses.rb - About 1 hr to fix

    Method _request has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def _request(scheme, host, port, params, original_params, &block)
              connection(scheme, host, port).request(params, &block)
            rescue Excon::Errors::MovedPermanently, Excon::Errors::TemporaryRedirect => error
              headers = (error.response.is_a?(Hash) ? error.response[:headers] : error.response.headers)
              new_params = {}
    Severity: Minor
    Found in lib/fog/aws/storage.rb - About 1 hr to fix

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

                def end_element(name)
                  case name
                  when 'member'
                    if @in_policy_attribute_types
                      @policy_type['PolicyAttributeTypeDescriptions'] << @policy_attribute_type_description
      Severity: Minor
      Found in lib/fog/aws/parsers/elb/describe_load_balancer_policy_types.rb - About 1 hr to fix

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

                  def end_element(name)
                    case @configuration
                    when 'topic'
                      case name
                      when 'Id', 'Event', 'Topic'
        Severity: Minor
        Found in lib/fog/aws/parsers/storage/get_bucket_notification.rb - About 1 hr to fix

          Method create_cache_cluster has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  def create_cache_cluster(id, options = {})
                    req_options = {
                      'Action'          => 'CreateCacheCluster',
                      'CacheClusterId'  => id.strip,
                      'CacheNodeType'   => options[:node_type]  || 'cache.m1.large',
          Severity: Minor
          Found in lib/fog/aws/requests/elasticache/create_cache_cluster.rb - About 1 hr to fix

            Method create_cache_cluster has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    def create_cache_cluster(id, options = {})
                      response        = Excon::Response.new
                      cluster         = { # create an in-memory representation of this cluster
                        'CacheClusterId'  => id.strip,
                        'NumCacheNodes'   => options[:num_nodes]      || 1,
            Severity: Minor
            Found in lib/fog/aws/requests/elasticache/create_cache_cluster.rb - About 1 hr to fix

              Method store_mock_object has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      def store_mock_object(bucket, object_name, body, options)
                        object = {
                          :body             => body,
                          'Content-Type'    => options['Content-Type'],
                          'ETag'            => OpenSSL::Digest::MD5.hexdigest(body),
              Severity: Minor
              Found in lib/fog/aws/requests/storage/shared_mock_methods.rb - About 1 hr to fix

                Method set_load_balancer_policies_of_listener has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        def set_load_balancer_policies_of_listener(lb_name, load_balancer_port, policy_names)
                          raise Fog::AWS::ELB::NotFound unless load_balancer = self.data[:load_balancers][lb_name]
                
                          policy_names = [*policy_names]
                          response = Excon::Response.new
                Severity: Minor
                Found in lib/fog/aws/requests/elb/set_load_balancer_policies_of_listener.rb - About 1 hr to fix

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

                          def create_load_balancer(availability_zones, lb_name, listeners, options = {})
                            params = Fog::AWS.indexed_param('AvailabilityZones.member', [*availability_zones])
                            params.merge!(Fog::AWS.indexed_param('Subnets.member.%d', options[:subnet_ids]))
                            params.merge!(Fog::AWS.serialize_keys('Scheme', options[:scheme]))
                            params.merge!(Fog::AWS.indexed_param('SecurityGroups.member.%d', options[:security_groups]))
                  Severity: Minor
                  Found in lib/fog/aws/requests/elb/create_load_balancer.rb - About 1 hr to fix

                    Method create_load_balancer_listeners has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            def create_load_balancer_listeners(lb_name, listeners)
                              load_balancer = data[:load_balancers][lb_name]
                              raise Fog::AWS::ELB::NotFound unless load_balancer
                              response = Excon::Response.new
                    
                    
                    Severity: Minor
                    Found in lib/fog/aws/requests/elb/create_load_balancer_listeners.rb - About 1 hr to fix

                      Method put_object_acl has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              def put_object_acl(bucket_name, object_name, acl, options = {})
                                query = {'acl' => nil}
                                if version_id = options.delete('versionId')
                                  query['versionId'] = version_id
                                end
                      Severity: Minor
                      Found in lib/fog/aws/requests/storage/put_object_acl.rb - About 1 hr to fix

                        Method describe_tasks has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

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

                          Consider simplifying this complex logical expression.
                          Open

                                    if @endpoint = options[:endpoint]
                                      endpoint = URI.parse(@endpoint)
                                      @host = endpoint.host or raise InvalidURIError.new("could not parse endpoint: #{@endpoint}")
                                      @path = endpoint.path
                                      @port = endpoint.port
                          Severity: Major
                          Found in lib/fog/aws/compute.rb - About 1 hr to fix

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

                                    def _request(method, path, query, body, headers, expects, idempotent, parser=nil)
                            Severity: Major
                            Found in lib/fog/aws/lambda.rb - About 1 hr to fix

                              Consider simplifying this complex logical expression.
                              Open

                                        if @endpoint = options[:endpoint]
                                          endpoint = URI.parse(@endpoint)
                                          @host = endpoint.host or raise InvalidURIError.new("could not parse endpoint: #{@endpoint}")
                                          @path = endpoint.path
                                          @port = endpoint.port
                              Severity: Major
                              Found in lib/fog/aws/compute.rb - About 1 hr to fix

                                Consider simplifying this complex logical expression.
                                Open

                                          elsif options['IpPermissions']
                                            options['IpPermissions'].each do |permission|
                                
                                              groups = (permission['Groups'] || []).map do |authorized_group|
                                                security_group = if group_name = authorized_group['GroupName']
                                Severity: Major
                                Found in lib/fog/aws/requests/compute/authorize_security_group_ingress.rb - About 1 hr to fix

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

                                            def end_element(name)
                                              case name
                                              when 'CommonPrefixes'
                                                @in_common_prefixes = false
                                              when 'Contents'
                                  Severity: Minor
                                  Found in lib/fog/aws/parsers/storage/get_bucket.rb - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                            def end_element(name)
                                              if @in_tag_set
                                                case name
                                                  when 'item'
                                                    @internet_gateway['tagSet'][@tag['key']] = @tag['value']
                                  Severity: Minor
                                  Found in lib/fog/aws/parsers/compute/describe_internet_gateways.rb - About 55 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 save has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                          def save
                                            if identity
                                              update_params = {
                                                'Size'       => self.size,
                                                'Iops'       => self.iops,
                                  Severity: Minor
                                  Found in lib/fog/aws/models/compute/volume.rb - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                            def end_element(name)
                                              if @in_attachment_set
                                                case name
                                                when 'attachmentSet'
                                                  @in_attachment_set = false
                                  Severity: Minor
                                  Found in lib/fog/aws/parsers/compute/describe_volumes.rb - About 55 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