Showing 76 of 122 total issues
Avoid too many return
statements within this method. Open
Open
return Result.new(:success => false, :errors => [Exception.new(result.to_hash['error_description'])])
Avoid too many return
statements within this method. Open
Open
return Result.new(:success => true, :value => instance)
Avoid too many return
statements within this method. Open
Open
return Result.new(:success => false, :errors => [Exception.new(data['error_description'])], :value => data)
Avoid too many return
statements within this method. Open
Open
return Result.new(:success => false, :errors => [Exception.new('No refresh token was specified, nor was a username/password/account')])
Avoid too many return
statements within this method. Open
Open
return Result.new(:success => false, :errors => [Exception.new(e.response['error_description'])], :value => e.response)
Avoid too many return
statements within this method. Open
Open
return Result.new(:success => false, :errors => [Exception.new(e.response['error_description'])], :value => e.response)
Avoid too many return
statements within this method. Open
Open
return Result.new(:success => false, :errors => result.errors, :value => instance)
Avoid too many return
statements within this method. Open
Open
return Result.new(:success => false, :errors => [Exception.new("#{reponse.code} #{response}")])
Avoid too many return
statements within this method. Open
Open
return Result.new(:success => false, :errors => result.errors, :value => result.value)
Avoid too many return
statements within this method. Open
Open
return Result.new(:success => false, :errors => [Exception.new(result.to_hash['error_description'])])
Avoid too many return
statements within this method. Open
Open
return Result.new(:success => true, :value => access_token)
Avoid too many return
statements within this method. Open
Open
return Result.new(:success => false, :errors => [Exception.new('CloudFlow failed to complete successfully')])
Avoid too many return
statements within this method. Open
Open
return Result.new(:success => false, :errors => [Exception.new("Timed out after #{timeout}s waiting for Server (id=#{server_id}, name=#{server.name}, deployment_id=#{deployment_id}, deployment_name=#{deployment_name}) to reach state #{state}, currently in state #{server.state}")], :value => server)
Avoid too many return
statements within this method. Open
Open
return Result.new(:success => false, :errors => [Exception.new("#{reponse.code} #{response}")])
Method validate_server_fields
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def validate_server_fields(missing_fields = [])
if get_field('server_id').nil? and ((get_field('nickname').nil? or (get_field('deployment_id').nil? and get_field('deployment_name').nil?)))
missing_fields << '(nickname and deployment_id) or (nickname and deployment_name) or server_id'
end
validate_base_fields(missing_fields)
- 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 wait_for_task
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def wait_for_task(recipe, task, timeout=600, interval=5)
desired_summary = "completed: #{recipe}"
last_state = nil
i = 0
while i <= timeout do
- 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"