Showing 9 of 13 total issues
Method run_transaction_tests
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run_transaction_tests(customer)
puts "Creating 2 transactions with customer=#{customer.id}"
transaction = Paid::Transaction.create({
:amount => 100,
:description => 'a description',
Method refresh_from
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def refresh_from(json, api_method=nil)
unless json.is_a?(Hash)
json = {
:data => json
}
- 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 query_array
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.query_array(params, key_prefix=nil)
ret = []
params.each do |key, value|
if params.is_a?(Array)
value = key
- 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 symbolize_keys
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.symbolize_keys(obj)
if obj.is_a?(Hash)
ret = {}
obj.each do |key, value|
ret[(key.to_sym rescue key) || key] = symbolize_keys(value)
- 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 prepare_params
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.prepare_params(url, params, method)
if [:get, :head, :delete].include?(method)
unless params.empty?
url += URI.parse(url).query ? '&' : '?' + query_string(params)
end
- 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 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(method, path, params, headers, object, api_key=nil, api_base=nil)
Method sorta_deep_clone
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.sorta_deep_clone(json)
if json.is_a?(Hash)
ret = {}
json.each do |k, v|
ret[k] = sorta_deep_clone(v)
- 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 build
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.build(path, object, params)
ret = path.dup
if ret.include?(":")
matches = ret.scan(/:([^\/]*)/).flatten.map(&:to_sym)
missing = Set.new(matches)
- 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 determine_api_attribute_value
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.determine_api_attribute_value(name, raw_value)
if @api_attributes[name] && @api_attributes[name].has_key?(:constructor)
klass = Util.constantize(@api_attributes[name][:constructor])
if(klass.respond_to?(:construct))
klass.construct(raw_value)
- 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"