Showing 630 of 1,221 total issues

Method describe_instances has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

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

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

          service_id = params.delete('service')
Severity: Minor
Found in lib/fog/aws/requests/ecs/delete_service.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 create_mount_target has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

        def create_mount_target(file_system_id, subnet_id, options={})
          response               = Excon::Response.new
          default_security_group = mock_compute.data[:security_groups].find do |_, sg|
            sg['groupDescription'] == 'default_elb security group'
          end
Severity: Minor
Found in lib/fog/aws/requests/efs/create_mount_target.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_policy_versions has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

        def list_policy_versions(policy_arn, options={})
          limit  = options['MaxItems']
          marker = options['Marker']

          if limit
Severity: Minor
Found in lib/fog/aws/requests/iam/list_policy_versions.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 save has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def save
          requires :image_id, :flavor_id, :price

          options = {
            'AvailabilityZoneGroup'                          => availability_zone_group,
Severity: Minor
Found in lib/fog/aws/models/compute/spot_request.rb - About 1 hr to fix

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

          def self.match_error(error)
            if !Fog::AWS.json_response?(error.response)
              matchers = [
                lambda {|s| s.match(/(?:.*<Code>(.*)<\/Code>)(?:.*<Message>(.*)<\/Message>)/m)},
                lambda {|s| s.match(/.*<(.+Exception)>(?:.*<Message>(.*)<\/Message>)/m)}
    Severity: Minor
    Found in lib/fog/aws/errors.rb - About 1 hr to fix

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

              def save
                requires :alarm_name
                requires :comparison_operator
                requires :evaluation_periods
                requires :metric_name
      Severity: Minor
      Found in lib/fog/aws/models/cloud_watch/alarm_datum.rb - About 1 hr to fix

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

                  def start_element(name, attrs = [])
                    super
                    case name
                    when 'ListenerDescriptions'
                      @in_listeners = true
        Severity: Minor
        Found in lib/fog/aws/parsers/elb/describe_load_balancers.rb - About 1 hr to fix

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

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

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

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

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

                        def create_queue(name, options = {})
                          Excon::Response.new.tap do |response|
                            response.status = 200
                
                            now = Time.now
                Severity: Minor
                Found in lib/fog/aws/requests/sqs/create_queue.rb - About 1 hr to fix

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

                          def describe_instance_attribute(instance_id, attribute)
                            response = Excon::Response.new
                            if instance = self.data[:instances].values.find{ |i| i['instanceId'] == instance_id }
                              response.status = 200
                              response.body = {
                  Severity: Minor
                  Found in lib/fog/aws/requests/compute/describe_instance_attribute.rb - About 1 hr to fix

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

                            def create_db_snapshot(identifier, name)
                              response = Excon::Response.new
                              if data[:snapshots][name]
                                raise Fog::AWS::RDS::IdentifierTaken.new
                              end
                    Severity: Minor
                    Found in lib/fog/aws/requests/rds/create_db_snapshot.rb - About 1 hr to fix

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

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

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

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

                                  def create_db_cluster_snapshot(identifier, name)
                                    response = Excon::Response.new
                          
                                    if data[:cluster_snapshots][name]
                                      raise Fog::AWS::RDS::IdentifierTaken.new
                          Severity: Minor
                          Found in lib/fog/aws/requests/rds/create_db_cluster_snapshot.rb - About 1 hr to fix

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

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

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

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

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

                                        def create_launch_configuration(image_id, instance_type, launch_configuration_name, options = {})
                                          if self.data[:launch_configurations].key?(launch_configuration_name)
                                            raise Fog::AWS::AutoScaling::IdentifierTaken.new("Launch Configuration by this name already exists - A launch configuration already exists with the name #{launch_configuration_name}")
                                          end
                                          self.data[:launch_configurations][launch_configuration_name] = {
                                Severity: Minor
                                Found in lib/fog/aws/requests/auto_scaling/create_launch_configuration.rb - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language