Showing 13 of 13 total issues
Method cached
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def cached api, opts={}, &block
stored = client.get(key(api, opts))
result = opts[:plain] ? stored : stored.decachify if stored && !stored.to_s.empty?
unless result
- 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 cached
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def cached api, opts={}, &block
if result = client.get(key(api, opts))
result = opts[:plain] ? result : result.decachify
else
result = super
- 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 to
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def to other, options={}
other = ISO.assert_currency!(other)
if api_supports_currency?(currency) && api_supports_currency?(other)
opts = { :at => time, :from => self }.merge(options)
- 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 stringify
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def stringify amount, currency, opts={}
definition = definitions[currency]
separators = definition[:separators] || {}
format = "%.#{definition[:minor_unit]}f"
string = format % amount
- 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 cached
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def cached api, opts={}, &block
raise_caching_needs_block! unless block_given?
today = Time.now
dir = config.path
- 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 install_money_getter
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def install_money_getter attribute, options={}
define_method :"#{attribute}_with_exchange_typecasting" do
currency = evaluate_money_option(options[:currency]) if options[:currency]
- 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 load_url
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def load_url url, retries, retry_with
begin
result = URI.parse(url).open.read
rescue SocketError
raise APIError.new("Calling API #{url} produced a socket error")
- 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 initialize
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def initialize url, options={}, &block
Exchange::GemLoader.new(options[:format] == :xml ? 'nokogiri' : 'json').try_load
result = cache_config.subclass.cached(options[:api] || config.subclass, options) do
load_url(url, options[:retries] || config.retries, options[:retry_with])
- 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 clean!
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def clean!
time = Time.now
instance_variables.select do |i|
condition = false
- 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 cached
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def cached api, opts={}, &block
ivar_name = instance_variable_name(api, opts)
result = instance_variable_get(ivar_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 precision_from_match
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def precision_from_match major, minor, rational=nil
if rational
leftover_minor_precision = minor.eql?('0') ? 0 : minor.size
rational_precision = rational.delete('-').to_i
[major.size, leftover_minor_precision.send(rational.start_with?('-') ? :+ : :-, rational_precision)]
- 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 cached
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def cached api, opts={}, &block
raise_caching_needs_block! unless block_given?
result = client.fetch key(api, opts), :expires_in => config.expire == :daily ? 86400 : 3600, &block
client.delete(key(api, opts)) unless result && !result.to_s.empty?
- 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 map_to_currency_or_rate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def map_to_currency_or_rate xml
unless (values = xml.attributes.values).empty?
values.map { |v|
val = v.value
val.match(/\d+/) ? BigDecimal.new(val) : val.downcase.to_sym
- 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"