CloudHealth/amazon-pricing

View on GitHub

Showing 56 of 77 total issues

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

    def fetch_ec2_dedicated_host_pricing(url, operating_system)
      res = PriceList.fetch_url(url)
      begin
        res['config']['regions'].each do |reg|
          region_name = reg['region']
Severity: Minor
Found in lib/amazon-pricing/ec2-dh-price-list.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 update_pricing has a Cognitive Complexity of 8 (exceeds 5 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 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 price_per_hour has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def price_per_hour(category_type, type_of_instance, term = nil, is_multi_az = false, isByol = false)
Severity: Minor
Found in lib/amazon-pricing/definitions/instance-type.rb - About 35 mins to fix

    Method update_pricing has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def update_pricing(database_type, type_of_instance, json, is_multi_az, is_byol)
    Severity: Minor
    Found in lib/amazon-pricing/definitions/rds-instance-type.rb - About 35 mins to fix

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

          def update_pricing_new(operating_system, type_of_instance, price, term = nil, is_prepay = false)
      Severity: Minor
      Found in lib/amazon-pricing/definitions/ec2-instance-type.rb - About 35 mins to fix

        Method get_breakeven_month has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def get_breakeven_month(category_types, type_of_instance, term, is_multi_az = false, isByol = false)
        Severity: Minor
        Found in lib/amazon-pricing/definitions/instance-type.rb - About 35 mins to fix

          Method ensure_existence_of_instance_type has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

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

            Method fetch_on_demand_rds_instance_pricing has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def fetch_on_demand_rds_instance_pricing(url, type_of_rds_instance, db_type, is_byol, is_multi_az = false)
            Severity: Minor
            Found in lib/amazon-pricing/rds-price-list.rb - About 35 mins to fix

              Method prepay has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def prepay(category_type, type_of_instance, term = nil, is_multi_az = false, isByol = false)
              Severity: Minor
              Found in lib/amazon-pricing/definitions/instance-type.rb - About 35 mins to fix

                Method fetch_on_demand_elasticache_node_pricing has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def fetch_on_demand_elasticache_node_pricing(url, cache_type)
                      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/elasticache-price-list.rb - About 35 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 fetch_reserved_elasticache_node_pricing has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def fetch_reserved_elasticache_node_pricing(url, cache_type)
                      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/elasticache-price-list.rb - About 35 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 fetch_on_demand_rds_instance_pricing has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def fetch_on_demand_rds_instance_pricing(url, type_of_rds_instance, db_type, is_byol, is_multi_az = false)
                      #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 35 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 database_sf_from_engine_name_and_license_type? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def self.database_sf_from_engine_name_and_license_type?(engine_name, is_byol)
                      engine_name_sym = engine_name.gsub('-', '_').to_sym
                      if @@DB_Deploy_Types[engine_name_sym] && @@DB_Deploy_Types[engine_name_sym].include?(:byol)
                        product_name = is_byol ? "#{engine_name}(byol)" : "#{engine_name}(li)"
                      else
                Severity: Minor
                Found in lib/amazon-pricing/definitions/database-type.rb - About 25 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 get_breakeven_month has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def get_breakeven_month(type_of_instance, term)
                      # Some regions and types do not have reserved available
                      ondemand_pph = price_per_hour(:ondemand)
                      reserved_pph = price_per_hour(type_of_instance, term)
                      return nil if ondemand_pph.nil? || reserved_pph.nil?
                Severity: Minor
                Found in lib/amazon-pricing/definitions/category-type.rb - About 25 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 get_category_type has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def get_category_type(name, multi_az = false, byol = false)
                      if multi_az == true and byol == true
                        db = @category_types["#{name}_byol_multiaz"]
                      elsif multi_az == true and byol == false
                        db = @category_types["#{name}_multiaz"]
                Severity: Minor
                Found in lib/amazon-pricing/definitions/instance-type.rb - About 25 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 fetch_reserved_rds_instance_pricing has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def fetch_reserved_rds_instance_pricing(url, type_of_rds_instance, db_type, 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 25 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

                Severity
                Category
                Status
                Source
                Language