Showing 630 of 1,221 total issues

Method modify_image_attribute has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

        def modify_image_attribute(image_id, attributes)
          raise ArgumentError.new("image_id is required") unless image_id

          unless self.data[:images][image_id]
            raise Fog::AWS::Compute::NotFound.new("The AMI ID '#{image_id}' does not exist")
Severity: Minor
Found in lib/fog/aws/requests/compute/modify_image_attribute.rb - About 55 mins 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 update_event_source_mapping has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

        def update_event_source_mapping(params={})
          mapping_id = params.delete('UUID')
          mapping = self.data[:event_source_mappings][mapping_id]

          unless mapping
Severity: Minor
Found in lib/fog/aws/requests/lambda/update_event_source_mapping.rb - About 55 mins 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 verify_permission_options has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

        def verify_permission_options(options, is_vpc)
          if options.size <= 1
            raise Fog::AWS::Compute::Error.new("InvalidRequest => The request received was invalid.")
          end
          if !is_vpc && options['IpProtocol'] && !['tcp', 'udp', 'icmp'].include?(options['IpProtocol'])
Severity: Minor
Found in lib/fog/aws/requests/compute/authorize_security_group_ingress.rb - About 55 mins 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 _request has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

        def _request(body, headers, idempotent, parser, method, path, expects)
Severity: Major
Found in lib/fog/aws/efs.rb - About 50 mins to fix

    Method replace_network_acl_entry has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            def replace_network_acl_entry(network_acl_id, rule_number, protocol, rule_action, cidr_block, egress, options = {})
    Severity: Major
    Found in lib/fog/aws/requests/compute/replace_network_acl_entry.rb - About 50 mins to fix

      Method replace_network_acl_entry has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              def replace_network_acl_entry(network_acl_id, rule_number, protocol, rule_action, cidr_block, egress, options = {})
      Severity: Major
      Found in lib/fog/aws/requests/compute/replace_network_acl_entry.rb - About 50 mins to fix

        Method create_network_acl_entry has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                def create_network_acl_entry(network_acl_id, rule_number, protocol, rule_action, cidr_block, egress, options = {})
        Severity: Major
        Found in lib/fog/aws/requests/compute/create_network_acl_entry.rb - About 50 mins to fix

          Method create_network_acl_entry has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  def create_network_acl_entry(network_acl_id, rule_number, protocol, rule_action, cidr_block, egress, options = {})
          Severity: Major
          Found in lib/fog/aws/requests/compute/create_network_acl_entry.rb - About 50 mins to fix

            Avoid deeply nested control flow statements.
            Open

                            if region.nil?
                              connection = options[:metadata_connection] || Excon.new(INSTANCE_METADATA_HOST)
                              token_header = fetch_credentials_token_header(connection, options[:disable_imds_v2])
                              region = connection.get(:path => INSTANCE_METADATA_AZ, :idempotent => true, :expects => 200, :headers => token_header).body[0..-2]
                            end
            Severity: Major
            Found in lib/fog/aws/credential_fetcher.rb - About 45 mins to fix

              Method add_rule has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      def add_rule(rule_number, protocol, rule_action, cidr_block, egress, options = {})
              Severity: Minor
              Found in lib/fog/aws/models/compute/network_acl.rb - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                @configuration_endpoint[name] = value ? value.strip : name
                Severity: Major
                Found in lib/fog/aws/parsers/elasticache/cache_cluster_parser.rb - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                case name
                                when 'member'
                                  @response['Stacks'] << @stack
                                  @stack = { 'Outputs' => [], 'Parameters' => [], 'Capabilities' => [], 'Tags' => []}
                                when 'RequestId'
                  Severity: Major
                  Found in lib/fog/aws/parsers/cloud_formation/describe_stacks.rb - About 45 mins to fix

                    Method get has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                            def get(namespace, metric_name, dimensions=nil, period=nil, statistic=nil, unit=nil)
                    Severity: Minor
                    Found in lib/fog/aws/models/cloud_watch/alarm_data.rb - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                    case name
                                    when 'ID', 'Prefix'
                                      @rule[name] = value
                                    when 'Status'
                                      @rule['Enabled'] = value == 'Enabled'
                      Severity: Major
                      Found in lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb - About 45 mins to fix

                        Method munge has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                                def munge(data)
                                  data.reduce([]) { |m,e|
                                    policy_attribute_descriptions = e["PolicyAttributeDescriptions"]
                        
                                    policy = {
                        Severity: Minor
                        Found in lib/fog/aws/models/elb/policies.rb - About 45 mins 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 _request has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                                def _request(params)
                                  response = @connection.request(params)
                        
                                  unless response.body.empty?
                                    response.body = Fog::JSON.decode(response.body)
                        Severity: Minor
                        Found in lib/fog/aws/data_pipeline.rb - About 45 mins 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_in_threads has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                                def upload_in_threads(target_directory_key, target_file_key, upload_id, pending, completed, thread_count)
                        Severity: Minor
                        Found in lib/fog/aws/models/storage/file.rb - About 45 mins to fix

                          Method save has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                                  def save
                                    requires :id
                                    requires :listeners
                                    # with the VPC release, the ELB can have either availability zones or subnets
                                    # if both are specified, the availability zones have preference
                          Severity: Minor
                          Found in lib/fog/aws/models/elb/load_balancer.rb - About 45 mins 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

                          Avoid deeply nested control flow statements.
                          Open

                                            if replace_attributes[item_key].include?(attribute_key)
                                              encoded_attributes["Item.#{item_index}.Attribute.#{attribute_index}.Replace"] = 'true'
                                            end
                          Severity: Major
                          Found in lib/fog/aws/simpledb.rb - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                          case name
                                          when 'member'
                                            @stack['Capabilities'] << value
                                          when 'Capabilities'
                                            @in_capabilities = false
                            Severity: Major
                            Found in lib/fog/aws/parsers/cloud_formation/describe_stacks.rb - About 45 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language