Showing 630 of 1,221 total issues

Method replace_route has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

        def replace_route(route_table_id, destination_cidr_block, options = {})
          options['instanceOwnerId'] ||= nil
          options['DestinationCidrBlock'] ||= destination_cidr_block

          route_table = self.data[:route_tables].find { |routetable| routetable["routeTableId"].eql? route_table_id }
Severity: Minor
Found in lib/fog/aws/requests/compute/replace_route.rb - About 2 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 modify_db_instance has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

        def modify_db_instance(db_name, apply_immediately, _options={})
          options = _options.dup
          response = Excon::Response.new
          if server = self.data[:servers][db_name]
            if server["DBInstanceStatus"] != "available"
Severity: Minor
Found in lib/fog/aws/requests/rds/modify_db_instance.rb - About 2 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 put_attributes has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

        def put_attributes(domain_name, item_name, attributes, options = {})
          options[:expect] = {} unless options[:expect]
          options[:replace] = [] unless options[:replace]
          response = Excon::Response.new
          if self.data[:domains][domain_name]
Severity: Minor
Found in lib/fog/aws/requests/simpledb/put_attributes.rb - About 2 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_service has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

        def create_service(params={})
          response = Excon::Response.new
          response.status = 200

          e = Fog::AWS::ECS::Error
Severity: Minor
Found in lib/fog/aws/requests/ecs/create_service.rb - About 2 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 get_attributes has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

        def get_attributes(domain_name, item_name, options = {})
          if options.is_a?(Array)
            Fog::Logger.deprecation("get_attributes with array attributes param is deprecated, use 'AttributeName' => attributes) instead [light_black](#{caller.first})[/]")
            options['AttributeName'] ||= options if options.is_a?(Array)
          end
Severity: Minor
Found in lib/fog/aws/requests/simpledb/get_attributes.rb - About 2 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 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

          def end_element(name)
            case name
            when 'AvailabilityZone', 'ClusterIdentifier', 'ClusterStatus', 'ClusterSubnetGroupName', 'DBName',
              'MasterUsername', 'ModifyStatus', 'PreferredMaintenanceWindow', 'VpcId'
              @cluster[name] = value
Severity: Major
Found in lib/fog/aws/parsers/redshift/cluster_parser.rb - About 2 hrs to fix

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

              def end_element(name)
                if @in_expiration
                  case name
                  when 'Days'
                    @expiration[name] = value.to_i
    Severity: Major
    Found in lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb - About 2 hrs to fix

      Method data has 59 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def self.data
                @data ||= Hash.new do |hash, region|
                  owner_id = Fog::AWS::Mock.owner_id
                  hash[region] = Hash.new do |region_hash, key|
                    region_hash[key] = {
      Severity: Major
      Found in lib/fog/aws/auto_scaling.rb - About 2 hrs to fix

        Method change_resource_record_sets_data has 58 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def self.change_resource_record_sets_data(zone_id, change_batch, version, options = {})
                # AWS methods return zone_ids that looks like '/hostedzone/id'.  Let the caller either use
                # that form or just the actual id (which is what this request needs)
                zone_id = zone_id.sub('/hostedzone/', '')
        
        
        Severity: Major
        Found in lib/fog/aws/dns.rb - About 2 hrs to fix

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

                    def end_element(name)
                      if @in_entry_set
                        if @in_port_range
                          case name
                          when 'portRange'
          Severity: Major
          Found in lib/fog/aws/parsers/compute/network_acl_parser.rb - About 2 hrs to fix

            Method run_instances has 58 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    def run_instances(image_id, min_count, max_count, options = {})
                      if block_device_mapping = options.delete('BlockDeviceMapping')
                        block_device_mapping.each_with_index do |mapping, index|
                          for key, value in mapping
                            options.merge!({ format("BlockDeviceMapping.%d.#{key}", index) => value })
            Severity: Major
            Found in lib/fog/aws/requests/compute/run_instances.rb - About 2 hrs to fix

              Method describe_volumes has 58 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      def describe_volumes(filters = {})
                        unless filters.is_a?(Hash)
                          Fog::Logger.deprecation("describe_volumes with #{filters.class} param is deprecated, use describe_volumes('volume-id' => []) instead [light_black](#{caller.first})[/]")
                          filters = {'volume-id' => [*filters]}
                        end
              Severity: Major
              Found in lib/fog/aws/requests/compute/describe_volumes.rb - About 2 hrs to fix

                Method acls has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        def self.acls(type)
                          case type
                          when 'private'
                            {
                              "AccessControlList" => [
                Severity: Major
                Found in lib/fog/aws/storage.rb - About 2 hrs to fix

                  Method list_resource_record_sets has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          def list_resource_record_sets(zone_id, options = {})
                            maxitems = [options[:max_items]||100,100].min
                  
                            response = Excon::Response.new
                  
                  
                  Severity: Major
                  Found in lib/fog/aws/requests/dns/list_resource_record_sets.rb - About 2 hrs to fix

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

                              def end_element(name)
                                if @in_outputs
                                  case name
                                  when 'OutputKey', 'OutputValue', 'Description'
                                    @output[name] = value
                    Severity: Major
                    Found in lib/fog/aws/parsers/cloud_formation/describe_stacks.rb - About 2 hrs to fix

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

                                def end_element(name)
                                  if @in_block_device_mapping
                                    case name
                                      when 'blockDeviceMapping'
                                        @in_block_device_mapping = false
                      Severity: Major
                      Found in lib/fog/aws/parsers/compute/describe_images.rb - About 2 hrs to fix

                        Method update_stack has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                def update_stack(stack_name, options = {})
                                  params = {
                                    'StackName' => stack_name,
                                  }
                        
                        
                        Severity: Major
                        Found in lib/fog/aws/requests/cloud_formation/update_stack.rb - About 2 hrs to fix

                          Method register_image has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  def register_image(name, description, location, block_devices=[], options={})
                                    unless name.empty?
                                      image = {
                                        'imageId' => Fog::AWS::Mock.image_id,
                                        'imageLocation' => '',
                          Severity: Major
                          Found in lib/fog/aws/requests/compute/register_image.rb - About 2 hrs to fix

                            Method [] has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                  def self.[](service)
                                    @@connections ||= Hash.new do |hash, key|
                                      hash[key] = case key
                                                    when :auto_scaling
                                                      Fog::AWS::AutoScaling.new
                            Severity: Major
                            Found in lib/fog/aws/service_mapper.rb - About 2 hrs to fix

                              Method request_params has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      def request_params(params)
                                        headers  = params[:headers] || {}
                              
                                        if params[:scheme]
                                          scheme = params[:scheme]
                              Severity: Major
                              Found in lib/fog/aws/storage.rb - About 2 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language