Showing 630 of 1,221 total issues

Method describe_snapshots has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

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

        def create_function(params={})
          response = Excon::Response.new

          runtime = params.delete('Runtime') || 'nodejs'
          if !%w(nodejs java8).include?(runtime)
Severity: Minor
Found in lib/fog/aws/requests/lambda/create_function.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 end_element has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

          def end_element(name)
            if @in_association_set
              case name
              when 'associationSet'
                @in_association_set = false
Severity: Minor
Found in lib/fog/aws/parsers/compute/describe_route_tables.rb - About 1 hr to fix

    Method delete_object has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def delete_object(bucket_name, object_name, options = {})
              response = Excon::Response.new
              if bucket = self.data[:buckets][bucket_name]
                response.status = 204
    
    
    Severity: Minor
    Found in lib/fog/aws/requests/storage/delete_object.rb - About 1 hr to fix

      Method put_bucket_logging has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def put_bucket_logging(bucket_name, logging_status)
                if logging_status['LoggingEnabled'].empty?
                  data =
      <<-DATA
      <BucketLoggingStatus xmlns="http://doc.s3.amazonaws.com/2006-03-01" />
      Severity: Minor
      Found in lib/fog/aws/requests/storage/put_bucket_logging.rb - About 1 hr to fix

        Method describe_network_acls has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                def describe_network_acls(filters = {})
                  response = Excon::Response.new
        
                  network_acls = self.data[:network_acls].values
                  network_acls = apply_tag_filters(network_acls, filters, 'networkAclId')
        Severity: Minor
        Found in lib/fog/aws/requests/compute/describe_network_acls.rb - About 1 hr to fix

          Method describe_spot_price_history has 46 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  def describe_spot_price_history(filters = {})
                    params = {}
                    spot_price_history_set = []
          
                    response = Excon::Response.new
          Severity: Minor
          Found in lib/fog/aws/requests/compute/describe_spot_price_history.rb - About 1 hr to fix

            Method create_network_acl has 46 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    def create_network_acl(vpcId, options = {})
                      response = Excon::Response.new
                      if vpcId
                        id = Fog::AWS::Mock.network_acl_id
            
            
            Severity: Minor
            Found in lib/fog/aws/requests/compute/create_network_acl.rb - About 1 hr to fix

              Method get_bucket has 45 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      def get_bucket(bucket_name, options = {})
                        prefix, marker, delimiter, max_keys = \
                          options['prefix'], options['marker'], options['delimiter'], options['max-keys']
                        common_prefixes = []
              
              
              Severity: Minor
              Found in lib/fog/aws/requests/storage/get_bucket.rb - About 1 hr to fix

                Method describe_clusters has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

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

                  Method match_error has a Cognitive Complexity of 14 (exceeds 5 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

                  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 14 (exceeds 5 allowed). Consider refactoring.
                  Open

                            def end_element(name)
                              case name
                              when 'Enabled'
                                if @cross_zone_load_balancing
                                  @cross_zone_load_balancing['Enabled'] = value == 'true' ? true : false
                  Severity: Minor
                  Found in lib/fog/aws/parsers/elb/describe_load_balancer_attributes.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 end_element has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                  Open

                            def end_element(name)
                              case name
                              when 'member'
                                if @in_availability_zones
                                  @auto_scaling_group['AvailabilityZones'] << value
                  Severity: Minor
                  Found in lib/fog/aws/parsers/auto_scaling/describe_auto_scaling_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 end_element has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                  Open

                            def end_element(name)
                              super
                              case name
                              when *@contexts
                                @context.pop
                  Severity: Minor
                  Found in lib/fog/aws/parsers/ecs/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 modify_cluster has a Cognitive Complexity of 14 (exceeds 5 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

                  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_records has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                  Open

                          def get_records(options={})
                            shard_iterator = Fog::JSON.decode(options.delete("ShardIterator"))
                            limit = options.delete("Limit") || -1
                            stream_name = shard_iterator["StreamName"]
                            shard_id = shard_iterator["ShardId"]
                  Severity: Minor
                  Found in lib/fog/aws/requests/kinesis/get_records.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 terminate_instances has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                  Open

                          def terminate_instances(instance_id)
                            response = Excon::Response.new
                            instance_id = [*instance_id]
                            if (self.data[:instances].keys & instance_id).length == instance_id.length
                              response.body = {
                  Severity: Minor
                  Found in lib/fog/aws/requests/compute/terminate_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 upload_server_certificate has a Cognitive Complexity of 14 (exceeds 5 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

                  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 authorize_security_group_ingress has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                  Open

                          def authorize_security_group_ingress(group_name, options = {})
                            options = Fog::AWS.parse_security_group_options(group_name, options)
                  
                            group = if options.key?('GroupName')
                                      self.data[:security_groups].values.find { |v| v['groupName'] == options['GroupName'] }
                  Severity: Minor
                  Found in lib/fog/aws/requests/compute/authorize_security_group_ingress.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 authorize_security_group_egress has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                  Open

                          def authorize_security_group_egress(group_name, options = {})
                            options = Fog::AWS.parse_security_group_options(group_name, options)
                  
                            group = if options.key?('GroupName')
                                      self.data[:security_groups].values.find { |v| v['groupName'] == options['GroupName'] }
                  Severity: Minor
                  Found in lib/fog/aws/requests/compute/authorize_security_group_egress.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

                  Severity
                  Category
                  Status
                  Source
                  Language