Showing 630 of 1,218 total issues

File flavors.rb has 4629 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'fog/aws/models/compute/flavor'

# To compute RAM from AWS doc https://aws.amazon.com/fr/ec2/instance-types
# we can use this formula: RAM (in MB) = AWS_RAM (in GiB) * 1073.742 MB/GiB
module Fog
Severity: Major
Found in lib/fog/aws/models/compute/flavors.rb - About 1 wk to fix

    Method put_bucket_lifecycle has a Cognitive Complexity of 129 (exceeds 5 allowed). Consider refactoring.
    Open

            def put_bucket_lifecycle(bucket_name, lifecycle)
              builder = Nokogiri::XML::Builder.new do
                LifecycleConfiguration {
                  lifecycle['Rules'].each do |rule|
                    Rule {
    Severity: Minor
    Found in lib/fog/aws/requests/storage/put_bucket_lifecycle.rb - About 2 days 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

    File storage.rb has 676 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module Fog
      module AWS
        class Storage < Fog::Service
          extend Fog::AWS::CredentialFetcher::ServiceMethods
    
    
    Severity: Major
    Found in lib/fog/aws/storage.rb - About 1 day to fix

      Method change_resource_record_sets has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
      Open

              def change_resource_record_sets(zone_id, change_batch, options = {})
                response = Excon::Response.new
                errors   = []
      
      
      
      Severity: Minor
      Found in lib/fog/aws/requests/dns/change_resource_record_sets.rb - About 1 day 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

      File compute.rb has 587 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      module Fog
        module AWS
          class Compute < Fog::Service
            extend Fog::AWS::CredentialFetcher::ServiceMethods
      
      
      Severity: Major
      Found in lib/fog/aws/compute.rb - About 1 day to fix

        Method get_object has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
        Open

                def get_object(bucket_name, object_name, options = {}, &block)
                  version_id = options.delete('versionId')
        
                  unless bucket_name
                    raise ArgumentError.new('bucket_name is required')
        Severity: Minor
        Found in lib/fog/aws/requests/storage/get_object.rb - About 1 day 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 51 (exceeds 5 allowed). Consider refactoring.
        Open

                  def end_element(name)
                    case name
                    when 'AutoMinorVersionUpgrade', 'CacheClusterId',
                      'CacheClusterStatus', 'CacheNodeType', 'Engine',
                      'PreferredAvailabilityZone', 'PreferredMaintenanceWindow'
        Severity: Minor
        Found in lib/fog/aws/parsers/elasticache/cache_cluster_parser.rb - About 7 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 associate_address has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
        Open

                def associate_address(*args)
                  if args.first.kind_of? Hash
                    params = args.first
                  else
                    params = {
        Severity: Minor
        Found in lib/fog/aws/requests/compute/associate_address.rb - About 7 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

        File policy_types.rb has 477 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        class Fog::AWS::ELB::Mock
          POLICY_TYPES = [{
            "Description" => "",
            "PolicyAttributeTypeDescriptions" => [{
              "AttributeName"=>"CookieName",
        Severity: Minor
        Found in lib/fog/aws/elb/policy_types.rb - About 7 hrs to fix

          Method describe_db_security_groups has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
          Open

                  def describe_db_security_groups(opts={})
                    response = Excon::Response.new
                    sec_group_set = []
                    if opts.is_a?(String)
                      sec_group_name = opts
          Severity: Minor
          Found in lib/fog/aws/requests/rds/describe_db_security_groups.rb - About 6 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 42 (exceeds 5 allowed). Consider refactoring.
          Open

                    def end_element(name)
                      if @in_instanceType
                        case name
                        when 'value'
                          @response['instanceType'] = value
          Severity: Minor
          Found in lib/fog/aws/parsers/compute/describe_instance_attribute.rb - About 6 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 41 (exceeds 5 allowed). Consider refactoring.
          Open

                    def end_element(name)
                      if @in_tag_set
                        case name
                          when 'item'
                            @security_group['tagSet'][@tag['key']] = @tag['value']
          Severity: Minor
          Found in lib/fog/aws/parsers/compute/describe_security_groups.rb - About 6 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_instances has 154 lines of code (exceeds 25 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: Major
          Found in lib/fog/aws/requests/compute/describe_instances.rb - About 6 hrs to fix

            Method delete_object has a Cognitive Complexity of 38 (exceeds 5 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 5 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_db_instance has a Cognitive Complexity of 38 (exceeds 5 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: Minor
            Found in lib/fog/aws/requests/rds/create_db_instance.rb - About 5 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 change_resource_record_sets_data has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
            Open

                  def self.change_resource_record_sets_data(zone_id, change_batch, version, options = {})
                    # AWS methods return zone_ids that looks like '/hostedzone/id'.  Let the caller either use
                    # that form or just the actual id (which is what this request needs)
                    zone_id = zone_id.sub('/hostedzone/', '')
            
            
            Severity: Minor
            Found in lib/fog/aws/dns.rb - About 5 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_volume has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
            Open

                    def create_volume(availability_zone, size, options = {})
                      unless options.is_a?(Hash)
                        Fog::Logger.deprecation("create_volume with a bare snapshot_id is deprecated, use create_volume(availability_zone, size, 'SnapshotId' => snapshot_id) instead [light_black](#{caller.first})[/]")
                        options = { 'SnapshotId' => options }
                      end
            Severity: Minor
            Found in lib/fog/aws/requests/compute/create_volume.rb - About 5 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_instances has a Cognitive Complexity of 34 (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 5 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 Mock has 38 methods (exceeds 20 allowed). Consider refactoring.
            Open

                class Mock
                  def self.arn(vendor, account_id, path, region = nil)
                    "arn:aws:#{vendor}:#{region}:#{account_id}:#{path}"
                  end
            
            
            Severity: Minor
            Found in lib/fog/aws/mock.rb - About 5 hrs to fix

              Method delete_attributes has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
              Open

                      def delete_attributes(domain_name, item_name, attributes = nil)
                        response = Excon::Response.new
                        if self.data[:domains][domain_name]
                          if self.data[:domains][domain_name][item_name]
                            if attributes
              Severity: Minor
              Found in lib/fog/aws/requests/simpledb/delete_attributes.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

              Severity
              Category
              Status
              Source
              Language