Showing 248 of 368 total issues
Avoid too many return
statements within this method. Open
return _('Error, could not calculate state time: state is not monitored')
Avoid too many return
statements within this method. Open
return acc_stopped_time
Avoid too many return
statements within this method. Open
return val
Avoid too many return
statements within this method. Open
return Instance::STATE_PENDING
Avoid too many return
statements within this method. Open
return acc_stopped_time + (Time.now - time_last_stopped)
Avoid too many return
statements within this method. Open
return Instance::STATE_SHUTTING_DOWN
Avoid too many return
statements within this method. Open
return acc_shutting_down_time + (Time.now - time_last_shutting_down)
Avoid too many return
statements within this method. Open
return acc_running_time
Avoid too many return
statements within this method. Open
return acc_shutting_down_time
Method create_auth_key
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create_auth_key
raise "instance provider_account is not set" unless self.provider_account
client = self.provider_account.connect
return nil unless client && client.feature?(:instances, :authentication_key)
if key = client.create_key(:name => key_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 humanize_error
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def humanize_error(error, options={})
error = error.message if error.is_a?(Exception)
if error.match("Connection refused - connect\\(2\\)")
if options[:context] == :deltacloud
return I18n.translate('deltacloud.unreachable')
- 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 uptime_all
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def uptime_all
return nil if events.empty?
all_running = events.find_last_by_status_code(:all_running)
some_stopped = events.find_last_by_status_code(:some_stopped)
- 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 end_time
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def end_time
if events.find_last_by_status_code(:all_running)
ev = events.find_last_by_status_code(:some_stopped) || events.find_last_by_status_code(:all_stopped)
ev.present? ? ev.event_time : nil
else
- 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_completed_rollback
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def handle_completed_rollback
if self.state_changed? and self.state == STATE_ROLLBACK_COMPLETE
begin
if self.events.where(
:status_code => 'deployment_launch_match').count > 9
- 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 deployment_for_mustache
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def deployment_for_mustache(deployment)
{
:id => deployment.id,
:name => deployment.name,
:path => deployment_path(deployment),
- 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 check_destroyable_instances!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def check_destroyable_instances!
not_destroyable_instances = instances.find_all {|i| !i.destroyable?}
if not_destroyable_instances.empty?
true
else
- 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 all_groups
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def all_groups
group_list = []
group_list += self.user_groups if UserGroup.local_groups_active?
if UserGroup.ldap_groups_active?
ldap_group_names = Ldap.ldap_groups(self.username)
- 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_all
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def build_all
raise _('The Image you tried to access cannot be found. It may have been deleted.') unless @base_image
if @base_image.imported?
flash[:error] = _('Imported image can\'t be built or pushed')
redirect_to @base_image and return
- 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 valid_provider?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def valid_provider?
if deltacloud_provider.present?
client = connect
return false if client.nil?
return false unless client.driver(provider_type.deltacloud_driver).valid_provider? deltacloud_provider
- 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 update
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update
@user_group = UserGroup.find(params[:id])
require_privilege(Alberich::Privilege::MODIFY, User)
if params[:commit] == "Reset"
- 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"