Showing 10 of 17 total issues
Method handle_factory_callback
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def handle_factory_callback(pi)
case pi.status.upcase
when "COMPLETE"
pi.fsm_create_start if pi.fsm_create_state == "queued"
pi.fsm_create_complete unless pi.fsm_create_state == "complete"
- 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 handle_factory_callback
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def handle_factory_callback(ti)
case ti.status.upcase
when "COMPLETE"
ti.fsm_create_start if ti.fsm_create_state == "queued"
ti.fsm_create_complete unless ti.fsm_create_state == "complete"
- 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 request_with_oauth
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def request_with_oauth(method, path, *arguments)
@oauth_config = Tim::ImageFactory::Base.config || {}
# Take care to fall back to the standard request method if we don't have full OAuth credentials
unless use_oauth_for_url?("#{site.scheme}://#{site.host}:#{site.port}#{path}")
return request_without_oauth(method, path, *arguments)
- 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 included
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.included base
base.state_machine :fsm_create_state, :initial => :new do
event :fsm_create_request do
transition :new => :pending
end
Method replace_user_keys
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.replace_user_keys(map, user_keys)
modified_map = map.clone
map.each_pair do |key, value|
# Sets the full template XML in the template.xml attribute
if key == "template" || key == :template
- 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 request_with_oauth
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def request_with_oauth(method, path, *arguments)
@oauth_config = Tim::ImageFactory::Base.config || {}
# Take care to fall back to the standard request method if we don't have full OAuth credentials
unless use_oauth_for_url?("#{site.scheme}://#{site.host}:#{site.port}#{path}")
return request_without_oauth(method, path, *arguments)
Method after_fsm_create_request
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def after_fsm_create_request(pi, transition)
if pi.imported?
if pi.send(:create_import)
pi.fsm_create_accept
pi.fsm_create_start
- 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 transform_resource_links_recursively
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def transform_resource_links_recursively(subparams, sublinks)
return if subparams == nil
case sublinks
when Symbol # then transform the link (last level of recursion)
- 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 api_behavior
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def api_behavior(error)
raise error unless resourceful?
status = :ok
begin
- 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 request
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def request(method, path, *arguments)
result = ActiveSupport::Notifications.instrument("request.active_resource") do |payload|
payload[:method] = method
payload[:request_uri] = "#{site.scheme}://#{site.host}:#{site.port}#{path}"
if method == :delete && arguments.size > 1
- 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"