Showing 56 of 77 total issues
File instance-type.rb
has 656 lines of code (exceeds 250 allowed). Consider refactoring. Open
module AwsPricing
class UnknownTypeError < NameError
end
Method get_rds_on_demand_instance_pricing
has a Cognitive Complexity of 34 (exceeds 5 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|
#
- Read upRead up
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 a Cognitive Complexity of 31 (exceeds 5 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|
- Read upRead up
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_ec2_instance_pricing_ri_v2
has a Cognitive Complexity of 26 (exceeds 5 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)
- Read upRead up
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 a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def update_pricing_new(database_type, type_of_instance, prices, term = nil, is_multi_az, is_byol)
db = get_category_type(database_type, is_multi_az, is_byol)
if db.nil?
db = DatabaseType.new(self, database_type)
- Read upRead up
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 23 (exceeds 5 allowed). Consider refactoring. Open
def update_pricing(database_type, type_of_instance, json, is_multi_az, is_byol)
db = get_category_type(database_type, is_multi_az, is_byol)
if db.nil?
db = DatabaseType.new(self, database_type)
- Read upRead up
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_price_per_hour
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def set_price_per_hour(type_of_instance, term, price_per_hour)
case type_of_instance
when :ondemand
@ondemand_price_per_hour = price_per_hour
when :light
- Read upRead up
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_prepay
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def set_prepay(type_of_instance, term, price)
case type_of_instance
when :light
if term == :year1
@light_prepay_1_year = price
- Read upRead up
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 prepay
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def prepay(type_of_instance = :ondemand, term = nil)
case type_of_instance
when :ondemand
0
when :light
- Read upRead up
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 a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def price_per_hour(type_of_instance = :ondemand, term = nil)
case type_of_instance
when :ondemand
@ondemand_price_per_hour
when :light
- Read upRead up
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 database-type.rb
has 264 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'amazon-pricing/definitions/category-type'
module AwsPricing
class DatabaseType < CategoryType
Class InstanceType
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class InstanceType
attr_accessor :name, :api_name, :memory_in_mb, :platform, :compute_units, :virtual_cores, :disk_type, :disk_in_gb
def initialize(region, api_name, name)
@category_types = {}
Method update_pricing2
has a Cognitive Complexity of 17 (exceeds 5 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)
db = get_category_type(database_type, is_multi_az, is_byol)
if db.nil?
db = DatabaseType.new(self, database_type)
- Read upRead up
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 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update_pricing(database_type, type_of_instance, json, is_multi_az, is_byol)
db = get_category_type(database_type, is_multi_az, is_byol)
if db.nil?
db = DatabaseType.new(self, database_type)
Method price_per_hour
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def price_per_hour(type_of_instance = :ondemand, term = nil)
case type_of_instance
when :ondemand
@ondemand_price_per_hour
when :light
Method set_prepay
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def set_prepay(type_of_instance, term, price)
case type_of_instance
when :light
if term == :year1
@light_prepay_1_year = price
Method prepay
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def prepay(type_of_instance = :ondemand, term = nil)
case type_of_instance
when :ondemand
0
when :light
Method set_price_per_hour
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def set_price_per_hour(type_of_instance, term, price_per_hour)
case type_of_instance
when :ondemand
@ondemand_price_per_hour = price_per_hour
when :light
Method fetch_url
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def self.fetch_url(url)
# AWS appears to have started throttling URL accesses, so we now have to retry
begin
retry_count ||= 0
#$stdout.puts "[#{__method__}] url:#{url}"
- Read upRead up
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 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update_pricing_new(database_type, type_of_instance, prices, term = nil, is_multi_az, is_byol)
db = get_category_type(database_type, is_multi_az, is_byol)
if db.nil?
db = DatabaseType.new(self, database_type)