CloudHealth/amazon-pricing

View on GitHub

Showing 56 of 77 total issues

Method fetch_ec2_instance_pricing_ri_v2 has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def fetch_ec2_instance_pricing_ri_v2(url, operating_system)
      res = PriceList.fetch_url(url)
      res['config']['regions'].each do |reg|
        region_name = reg['region']
        region = get_region(region_name)
Severity: Minor
Found in lib/amazon-pricing/common/ec2_common.rb - About 1 hr to fix

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

        def get_ec2_legacy_reserved_instance_pricing
          @@OS_TYPES.each do |os|
            @@LEGACY_RES_TYPES.each do |res_type|
              fetch_ec2_instance_pricing(EC2_BASE_URL + "#{os}-ri-#{res_type}.min.js", res_type, os)
              # Rinse & repeat for legacy instances (note: amazon changed URLs for legacy reserved instances)
    Severity: Minor
    Found in lib/amazon-pricing/ec2-price-list.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 fetch_reserved_rds_instance_pricing2 has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def fetch_reserved_rds_instance_pricing2(url, dbs, is_multi_az, is_byol)
          #logger.debug "[#{__method__}] fetched #{url}"
          res = PriceList.fetch_url(url)
          res['config']['regions'].each do |reg|
            region_name = reg['region']
    Severity: Minor
    Found in lib/amazon-pricing/rds-price-list.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_rds_reserved_instance_pricing has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def get_rds_reserved_instance_pricing
          @@DB_TYPE.each do |db|
            next if @@NO_LEGACY_RI_PRICING_AVAILABLE.include? db
            if [:mysql, :postgresql].include? db
              @@RES_TYPES.each do |res_type|
    Severity: Minor
    Found in lib/amazon-pricing/rds-price-list.rb - About 1 hr to fix

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

          def fetch_reserved_rds_instance_pricing2(url, dbs, is_multi_az, is_byol)
            #logger.debug "[#{__method__}] fetched #{url}"
            res = PriceList.fetch_url(url)
            res['config']['regions'].each do |reg|
              region_name = reg['region']
      Severity: Minor
      Found in lib/amazon-pricing/rds-price-list.rb - About 1 hr to fix

        Method update_pricing2 has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def update_pricing2(operating_system, res_type, ondemand_pph = nil, year1_prepay = nil, year3_prepay = nil, year1_pph = nil, year3_pph = nil)
        
              os = get_category_type(operating_system)
              if os.nil?
                os = OperatingSystem.new(self, operating_system)
        Severity: Minor
        Found in lib/amazon-pricing/definitions/ec2-instance-type.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 update_pricing has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def update_pricing(cache_type, type_of_instance, json)
              cache = get_category_type(cache_type)
              if cache.nil?
                cache = Cache.new(self, cache_type)
                @category_types[cache_type] = cache
        Severity: Minor
        Found in lib/amazon-pricing/definitions/elasticache_node_type.rb - About 1 hr to fix

          Method update_pricing2 has 9 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def update_pricing2(database_type, type_of_instance, is_multi_az, is_byol, ondemand_pph = nil, year1_prepay = nil, year3_prepay = nil, year1_pph = nil, year3_pph = nil)
          Severity: Major
          Found in lib/amazon-pricing/definitions/rds-instance-type.rb - About 1 hr to fix

            Method get_rds_on_demand_instance_pricing has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def get_rds_on_demand_instance_pricing
                  @@DB_TYPE.each do |db|
                    @@OD_DB_DEPLOY_TYPE[db].each {|db_type, db_instances|
                      db_instances.each do |dp_type|
                        #
            Severity: Minor
            Found in lib/amazon-pricing/rds-price-list.rb - About 1 hr to fix

              Method update_pricing has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def update_pricing(operating_system, type_of_instance, json)
                    os = get_category_type(operating_system)
                    if os.nil?
                      os = OperatingSystem.new(self, operating_system)
                      @category_types[operating_system] = os
              Severity: Minor
              Found in lib/amazon-pricing/definitions/ec2-instance-type.rb - About 1 hr to fix

                Method fetch_ec2_instance_pricing has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    def fetch_ec2_instance_pricing(url, type_of_instance, operating_system)
                      res = PriceList.fetch_url(url)
                      res['config']['regions'].each do |reg|
                        region_name = reg['region']
                        region = get_region(region_name)
                Severity: Minor
                Found in lib/amazon-pricing/common/ec2_common.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 update_pricing has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    def update_pricing(cache_type, type_of_instance, json)
                      cache = get_category_type(cache_type)
                      if cache.nil?
                        cache = Cache.new(self, cache_type)
                        @category_types[cache_type] = cache
                Severity: Minor
                Found in lib/amazon-pricing/definitions/elasticache_node_type.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 api_name_to_nf has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                      def self.api_name_to_nf(name)
                        type = name.split('.').last
                        if (type == METAL)
                          # See if our metal instance has a hard-coded nf value
                          if !metal_to_nf[name].nil?
                Severity: Minor
                Found in lib/amazon-pricing/helpers/instance-type.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 update_pricing_new has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def update_pricing_new(operating_system, type_of_instance, price, term = nil, is_prepay = false)
                      os = get_category_type(operating_system)
                      if os.nil?
                        os = OperatingSystem.new(self, operating_system)
                        @category_types[operating_system] = os
                Severity: Minor
                Found in lib/amazon-pricing/definitions/ec2-instance-type.rb - About 1 hr to fix

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

                      def self.populate_lookups
                        # We use Linux on-demand to populate the lookup tables with the basic lookup information
                        ["http://a0.awsstatic.com/pricing/1/ec2/linux-od.min.js", "http://a0.awsstatic.com/pricing/1/ec2/previous-generation/linux-od.min.js"].each do |url|
                          res = AwsPricing::PriceList.fetch_url(url)
                  
                  
                  Severity: Minor
                  Found in lib/amazon-pricing/definitions/instance-type.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 set_od_price_if_missing has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def set_od_price_if_missing(region, region_name, api_name, operating_system, instance_type, type_json)
                        type_json["terms"].each do |term|
                          # handle case of ondemand pricing missing;  turns out od-pricing is also in ri-pricing
                          # (assumes od pricing has been set, iff both api_name+os are available)
                          if not region.instance_type_available?(api_name, :ondemand, operating_system)
                  Severity: Minor
                  Found in lib/amazon-pricing/common/ec2_common.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_pricing2 has 7 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def update_pricing2(operating_system, res_type, ondemand_pph = nil, year1_prepay = nil, year3_prepay = nil, year1_pph = nil, year3_pph = nil)
                  Severity: Major
                  Found in lib/amazon-pricing/definitions/ec2-instance-type.rb - About 50 mins to fix

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

                        def update_pricing_new(operating_system, type_of_instance, price, term = nil, is_prepay = false)
                          os = get_category_type(operating_system)
                          if os.nil?
                            os = OperatingSystem.new(self, operating_system)
                            @category_types[operating_system] = os
                    Severity: Minor
                    Found in lib/amazon-pricing/definitions/ec2-instance-type.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 set_od_price_if_missing has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def set_od_price_if_missing(region, region_name, api_name, operating_system, instance_type, type_json)
                    Severity: Minor
                    Found in lib/amazon-pricing/common/ec2_common.rb - About 45 mins to fix

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

                          def update_pricing_new(database_type, type_of_instance, prices, term = nil, is_multi_az, is_byol)
                      Severity: Minor
                      Found in lib/amazon-pricing/definitions/rds-instance-type.rb - About 45 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language