Showing 630 of 1,218 total issues

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

        def run_instances(image_id, min_count, max_count, options = {})
          response = Excon::Response.new
          response.status = 200

          group_set = [ (options['SecurityGroup'] || 'default') ].flatten
Severity: Major
Found in lib/fog/aws/requests/compute/run_instances.rb - About 4 hrs to fix

    Method end_element has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

              def end_element(name)
                if @context.last == 'BootstrapActions'
                  case name
                  when 'Name'
                    @bootstrap_actions[name] = value
    Severity: Minor
    Found in lib/fog/aws/parsers/emr/describe_job_flows.rb - About 4 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

    Class LoadBalancer has 34 methods (exceeds 20 allowed). Consider refactoring.
    Open

          class LoadBalancer < Fog::Model
            identity  :id,                    :aliases => 'LoadBalancerName'
            attribute :availability_zones,    :aliases => 'AvailabilityZones'
            attribute :created_at,            :aliases => 'CreatedTime'
            attribute :dns_name,              :aliases => 'DNSName'
    Severity: Minor
    Found in lib/fog/aws/models/elb/load_balancer.rb - About 4 hrs to fix

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

                def end_element(name)
                  case name
      
                  when 'LatestRestorableTime', 'InstanceCreateTime'
                    @db_instance[name] = Time.parse value
      Severity: Major
      Found in lib/fog/aws/parsers/rds/db_parser.rb - About 4 hrs to fix

        Method create_load_balancer has 107 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                def create_load_balancer(availability_zones, lb_name, listeners = [], options = {})
                  response = Excon::Response.new
                  response.status = 200
        
                  raise Fog::AWS::ELB::IdentifierTaken if self.data[:load_balancers].key? lb_name
        Severity: Major
        Found in lib/fog/aws/requests/elb/create_load_balancer.rb - About 4 hrs to fix

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

                    def end_element(name)
                      if @in_instanceType
                        case name
                        when 'value'
                          @response['instanceType'] = value
          Severity: Major
          Found in lib/fog/aws/parsers/compute/describe_instance_attribute.rb - About 4 hrs to fix

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

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

              Method create_db_instance has 104 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      def create_db_instance(db_name, options={})
                        response = Excon::Response.new
                        if self.data[:servers] and self.data[:servers][db_name]
                          # I don't know how to raise an exception that contains the excon data
                          #response.status = 400
              Severity: Major
              Found in lib/fog/aws/requests/rds/create_db_instance.rb - About 4 hrs to fix

                Method create_network_interface has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                Open

                        def create_network_interface(subnetId, options = {})
                          response = Excon::Response.new
                          if subnetId
                            subnet = self.data[:subnets].find{ |s| s['subnetId'] == subnetId }
                            if subnet.nil?
                Severity: Minor
                Found in lib/fog/aws/requests/compute/create_network_interface.rb - About 4 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 fetch_credentials has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                Open

                        def fetch_credentials(options)
                          if options[:use_iam_profile] && Fog.mocking?
                            return Fog::AWS::Compute::Mock.data[:iam_role_based_creds]
                          end
                          if options[:use_iam_profile]
                Severity: Minor
                Found in lib/fog/aws/credential_fetcher.rb - About 3 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 a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                Open

                          def end_element(name)
                            case name
                
                            when 'LatestRestorableTime', 'InstanceCreateTime'
                              @db_instance[name] = Time.parse value
                Severity: Minor
                Found in lib/fog/aws/parsers/rds/db_parser.rb - About 3 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_bucket_object_versions has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                Open

                        def get_bucket_object_versions(bucket_name, options = {})
                          delimiter, key_marker, max_keys, prefix, version_id_marker = \
                            options['delimiter'], options['key-marker'], options['max-keys'],options['prefix'],options['version-id-marker']
                
                          unless bucket_name
                Severity: Minor
                Found in lib/fog/aws/requests/storage/get_bucket_object_versions.rb - About 3 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 describe_db_instances has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                Open

                        def describe_db_instances(identifier=nil, opts={})
                          response = Excon::Response.new
                          server_set = []
                          if identifier
                            if specified_server = self.data[:servers][identifier]
                Severity: Minor
                Found in lib/fog/aws/requests/rds/describe_db_instances.rb - About 3 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 delete_security_group has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                Open

                        def delete_security_group(name, id = nil)
                          if name == 'default'
                            raise Fog::AWS::Compute::Error.new("InvalidGroup.Reserved => The security group 'default' is reserved")
                          end
                
                
                Severity: Minor
                Found in lib/fog/aws/requests/compute/delete_security_group.rb - About 3 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 request_params has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                Open

                        def request_params(params)
                          headers  = params[:headers] || {}
                
                          if params[:scheme]
                            scheme = params[:scheme]
                Severity: Minor
                Found in lib/fog/aws/storage.rb - About 3 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_health_check has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                Open

                        def create_health_check(ip_address, port, type, options = {})
                          version = @version
                          builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|
                            xml.CreateHealthCheckRequest(:xmlns => "https://route53.amazonaws.com/doc/#{version}/") do
                              xml.CallerReference options[:caller_reference] || "#{Time.now.to_i.to_s}-#{SecureRandom.hex(6)}"
                Severity: Minor
                Found in lib/fog/aws/requests/dns/create_health_check.rb - About 3 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 90 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                          def end_element(name)
                            case name
                            when 'amiLaunchIndex'
                              @instance[name] = value.to_i
                            when 'arn'
                Severity: Major
                Found in lib/fog/aws/parsers/compute/describe_instances.rb - About 3 hrs to fix

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

                            def end_element(name)
                              if @context.last == 'BootstrapActions'
                                case name
                                when 'Name'
                                  @bootstrap_actions[name] = value
                  Severity: Major
                  Found in lib/fog/aws/parsers/emr/describe_job_flows.rb - About 3 hrs to fix

                    Method end_element has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                    Open

                              def end_element(name)
                                case name
                                when 'ChangeSetId', 'ChangeSetName', 'Description', 'ExecutionStatus', 'StackId', 'StackName', 'StatusReason', 'Status'
                                  @response[name] = value
                                when 'CreationTime'
                    Severity: Minor
                    Found in lib/fog/aws/parsers/cloud_formation/describe_change_set.rb - About 3 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 hash_to_acl has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                    Open

                            def self.hash_to_acl(acl)
                              data =  "<AccessControlPolicy>\n"
                    
                              if acl['Owner'] && (acl['Owner']['ID'] || acl['Owner']['DisplayName'])
                                data << "  <Owner>\n"
                    Severity: Minor
                    Found in lib/fog/aws/requests/storage/acl_utils.rb - About 3 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

                    Severity
                    Category
                    Status
                    Source
                    Language