Showing 630 of 1,221 total issues

Method update_service has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

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

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

        def attach_classic_link_vpc(instance_id, vpc_id, security_group_ids, dry_run=false)
          response = Excon::Response.new
          vpc = self.data[:vpcs].find{ |v| v['vpcId'] == vpc_id }
          instance = self.data[:instances][instance_id]
          if vpc && instance
Severity: Minor
Found in lib/fog/aws/requests/compute/attach_classic_link_vpc.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_attached_user_policies has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

        def list_attached_user_policies(user_name, options={})
          unless self.data[:users].key?(user_name)
            raise Fog::AWS::IAM::NotFound.new("The user with name #{user_name} cannot be found.")
          end

Severity: Minor
Found in lib/fog/aws/requests/iam/list_attached_user_policies.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_attached_role_policies has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

        def list_attached_role_policies(role_name, options={})
          unless self.data[:roles].key?(role_name)
            raise Fog::AWS::IAM::NotFound.new("The role with name #{role_name} cannot be found.")
          end

Severity: Minor
Found in lib/fog/aws/requests/iam/list_attached_role_policies.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_resource_record_sets has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

        def list_resource_record_sets(zone_id, options = {})
          maxitems = [options[:max_items]||100,100].min

          response = Excon::Response.new

Severity: Minor
Found in lib/fog/aws/requests/dns/list_resource_record_sets.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 start_element has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

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

              def end_element(name)
                if @section == :resource_record_set
                  case name
                  when 'Type', 'TTL', 'SetIdentifier', 'Weight', 'Region', 'HealthCheckId', 'Failover'
                    @resource_record_set[name] = value
    Severity: Minor
    Found in lib/fog/aws/parsers/dns/list_resource_record_sets.rb - About 1 hr to fix

      Method modify_network_interface_attribute has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def modify_network_interface_attribute(network_interface_id, attribute, value)
                response = Excon::Response.new
                if self.data[:network_interfaces][network_interface_id]
                  nic = self.data[:network_interfaces][network_interface_id]
      
      
      Severity: Minor
      Found in lib/fog/aws/requests/compute/modify_network_interface_attribute.rb - About 1 hr to fix

        Method modify_volume has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                def modify_volume(volume_id, options={})
                  response = Excon::Response.new
                  volume   = self.data[:volumes][volume_id]
        
                  if volume["volumeType"] == 'standard' && options['VolumeType']
        Severity: Minor
        Found in lib/fog/aws/requests/compute/modify_volume.rb - About 1 hr to fix

          Method delete_service has 35 lines of code (exceeds 25 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

            Method authorize_security_group_ingress has 35 lines of code (exceeds 25 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

              Method authorize_security_group_egress has 35 lines of code (exceeds 25 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

                Method create_event_source_mapping has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        def create_event_source_mapping(params={})
                          enabled          = params.delete('Enabled')   || false
                          batch_size       = params.delete('BatchSize') || 100
                          event_source_arn = params.delete('EventSourceArn')
                          function_name    = params.delete('FunctionName')
                Severity: Minor
                Found in lib/fog/aws/requests/lambda/create_event_source_mapping.rb - About 1 hr to fix

                  Method list_policy_versions has 34 lines of code (exceeds 25 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

                    Method describe_services has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

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

                      Consider simplifying this complex logical expression.
                      Open

                                    elsif ENV["AWS_WEB_IDENTITY_TOKEN_FILE"]
                                      params = {
                                        :Action => "AssumeRoleWithWebIdentity",
                                        :RoleArn => options[:role_arn] || ENV.fetch("AWS_ROLE_ARN"),
                                        :RoleSessionName => options[:role_session_name] || ENV["AWS_ROLE_SESSION_NAME"] || "fog-aws-#{SecureRandom.hex}",
                      Severity: Critical
                      Found in lib/fog/aws/credential_fetcher.rb - About 1 hr to fix

                        Consider simplifying this complex logical expression.
                        Open

                                  elsif bucket = self.data[:buckets][bucket_name]
                                    # We need to order results by S3 key, but since our data store is key => [versions], we want to ensure the integrity
                                    # of the versions as well.  So, sort the keys, then fetch the versions, and then combine them all as a sorted list by
                                    # flattening the results.
                                    contents = bucket[:objects].keys.sort.map { |key| bucket[:objects][key] }.flatten.reject do |object|
                        Severity: Critical
                        Found in lib/fog/aws/requests/storage/get_bucket_object_versions.rb - About 1 hr to fix

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

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

                                    def _request(body, headers, idempotent, parser, retries = 0)
                            
                                      max_retries = 10
                            
                                      begin
                            Severity: Minor
                            Found in lib/fog/aws/compute.rb - About 1 hr to fix

                              Method delete_multiple_objects has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      def delete_multiple_objects(bucket_name, object_names, options = {})
                                        headers = options.dup
                                        data = "<Delete>"
                                        data << "<Quiet>true</Quiet>" if headers.delete(:quiet)
                                        version_ids = headers.delete('versionId')
                              Severity: Minor
                              Found in lib/fog/aws/requests/storage/delete_multiple_objects.rb - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language