Showing 630 of 1,218 total issues

Method byte_ranges has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

        def byte_ranges(http_range, size)
          # See <http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35>
          return nil unless http_range
          ranges = []
          http_range.split(/,\s*/).each do |range_spec|
Severity: Minor
Found in lib/fog/aws/requests/storage/get_object.rb - About 3 hrs 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_object_helper has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

        def delete_object_helper(bucket, object_name, version_id)
          response = { 'Deleted' => {} }
          if bucket[:versioning]
            bucket[:objects][object_name] ||= []

Severity: Minor
Found in lib/fog/aws/requests/storage/delete_multiple_objects.rb - About 3 hrs 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 89 lines of code (exceeds 25 allowed). Consider refactoring.
Open

          def end_element(name)
            case name
            when 'member'
              if @in_policy_names && @in_listeners
                @listener_description['PolicyNames'] << value
Severity: Major
Found in lib/fog/aws/parsers/elb/describe_load_balancers.rb - About 3 hrs to fix

    Method end_element has a Cognitive Complexity of 24 (exceeds 5 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_image_attribute.rb - About 3 hrs 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 84 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

              def end_element(name)
                if @in_tag_set
                  case name
                    when 'item'
                      @security_group['tagSet'][@tag['key']] = @tag['value']
    Severity: Major
    Found in lib/fog/aws/parsers/compute/describe_security_groups.rb - About 3 hrs to fix

      Class File has 28 methods (exceeds 20 allowed). Consider refactoring.
      Open

            class File < Fog::Model
              # @deprecated use {Fog::AWS::Storage::MIN_MULTIPART_CHUNK_SIZE} instead
              MIN_MULTIPART_CHUNK_SIZE = Fog::AWS::Storage::MIN_MULTIPART_CHUNK_SIZE
              # @deprecated use {Fog::AWS::Storage::MAX_SINGLE_PUT_SIZE} instead
              MAX_SINGLE_PUT_SIZE = Fog::AWS::Storage::MAX_SINGLE_PUT_SIZE
      Severity: Minor
      Found in lib/fog/aws/models/storage/file.rb - About 3 hrs to fix

        Method normalize_permissions has 82 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                def normalize_permissions(options)
                  normalized_permissions = []
                  if options['SourceSecurityGroupName']
                    group_name = if options['SourceSecurityGroupName'] =~ /default_elb/
                                   "default"
        Severity: Major
        Found in lib/fog/aws/requests/compute/authorize_security_group_ingress.rb - About 3 hrs to fix

          Method tagged_resources has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
          Open

                  def tagged_resources(resources)
                    Array(resources).map do |resource_id|
                      if match = resource_id.match(/^(\w+)-[a-z0-9]{8,17}/i)
                        id = match.captures.first
                      else
          Severity: Minor
          Found in lib/fog/aws/compute.rb - About 3 hrs 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 23 (exceeds 5 allowed). Consider refactoring.
          Open

                    def end_element(name)
                      if @in_block_device_mapping
                        case name
                          when 'blockDeviceMapping'
                            @in_block_device_mapping = false
          Severity: Minor
          Found in lib/fog/aws/parsers/compute/describe_images.rb - About 3 hrs 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 23 (exceeds 5 allowed). Consider refactoring.
          Open

                    def end_element(name)
                      if @in_entry_set
                        if @in_port_range
                          case name
                          when 'portRange'
          Severity: Minor
          Found in lib/fog/aws/parsers/compute/network_acl_parser.rb - About 3 hrs 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_cache_security_groups has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
          Open

                  def describe_cache_security_groups(name = nil, opts={})
                    if name
                      sec_group_set = [self.data[:security_groups][name]].compact
                      raise Fog::AWS::Elasticache::NotFound.new("Security Group #{name} not found") if sec_group_set.empty?
                    else
          Severity: Minor
          Found in lib/fog/aws/requests/elasticache/describe_cache_security_groups.rb - About 3 hrs 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 receive_message has a Cognitive Complexity of 23 (exceeds 5 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 3 hrs 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 create_subnet has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
          Open

                  def create_subnet(vpcId, cidrBlock, options = {})
                    av_zone = options['AvailabilityZone'].nil? ? 'us-east-1c' : options['AvailabilityZone']
                    Excon::Response.new.tap do |response|
                      if cidrBlock && vpcId
                        vpc = self.data[:vpcs].find{ |v| v['vpcId'] == vpcId }
          Severity: Minor
          Found in lib/fog/aws/requests/compute/create_subnet.rb - About 3 hrs 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

          File file.rb has 299 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require 'fog/aws/models/storage/versions'
          
          module Fog
            module AWS
              class Storage
          Severity: Minor
          Found in lib/fog/aws/models/storage/file.rb - About 3 hrs to fix

            Method get_object has 79 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    def get_object(bucket_name, object_name, options = {}, &block)
                      version_id = options.delete('versionId')
            
                      unless bucket_name
                        raise ArgumentError.new('bucket_name is required')
            Severity: Major
            Found in lib/fog/aws/requests/storage/get_object.rb - About 3 hrs to fix

              File iam.rb has 297 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              module Fog
                module AWS
                  class IAM < Fog::Service
                    extend Fog::AWS::CredentialFetcher::ServiceMethods
              
              
              Severity: Minor
              Found in lib/fog/aws/iam.rb - About 3 hrs to fix

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

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

                        def create_load_balancer(availability_zones, lb_name, listeners = [], options = {})
                          response = Excon::Response.new
                          response.status = 200
                
                          raise Fog::AWS::ELB::IdentifierTaken if self.data[:load_balancers].key? lb_name
                Severity: Minor
                Found in lib/fog/aws/requests/elb/create_load_balancer.rb - About 3 hrs 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 77 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                          def end_element(name)
                            case name
                            when 'member'
                              if @in_availability_zones
                                @auto_scaling_group['AvailabilityZones'] << value
                Severity: Major
                Found in lib/fog/aws/parsers/auto_scaling/describe_auto_scaling_groups.rb - About 3 hrs to fix

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

                            def end_element(name)
                              super
                              case name
                              when 'taskDefinitionArn'
                                @response[@result][@definition][name] = value
                  Severity: Major
                  Found in lib/fog/aws/parsers/ecs/task_definition.rb - About 2 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language