lib/amazon-pricing/definitions/instance-type.rb
File instance-type.rb
has 656 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
module AwsPricing
class UnknownTypeError < NameError
end
Class InstanceType
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
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 populate_lookups
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
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)
- 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 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def price_per_hour(category_type, type_of_instance, term = nil, is_multi_az = false, isByol = false)
Method get_breakeven_month
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def get_breakeven_month(category_types, type_of_instance, term, is_multi_az = false, isByol = false)
Method prepay
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def prepay(category_type, type_of_instance, term = nil, is_multi_az = false, isByol = false)
Method get_category_type
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
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"]
- 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"