Showing 248 of 368 total issues
Method up
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.up
return if Role.all.empty?
Role.transaction do
role = Role.find_or_initialize_by_name(ROLE_NAME)
role.update_attributes({:name => ROLE_NAME, :scope => BasePermissionObject.name, :assign_to_owner => ROLE_DEF[0]})
Method multi_destroy
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def multi_destroy
destroyed = []
failed = []
permission_failed = []
error_messages = []
Method load_provider_tabs
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def load_provider_tabs
@realms = @provider.provider_realms.apply_filters(:preset_filter_id => params[:provider_realms_preset_filter], :search_filter => params[:provider_realms_search])
#TODO add links to real data for history,properties,permissions
@tabs = [{ :name => _('Properties'),
:view => 'properties',
Method up
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.up
return if Role.all.empty?
Role.transaction do
role = Role.find_or_initialize_by_name(ROLE_NAME)
role.update_attributes({:name => ROLE_NAME, :scope => BasePermissionObject.name, :assign_to_owner => ROLE_DEF[0]})
Method destroy
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def destroy
@hardware_profile = HardwareProfile.find(params[:id])
require_privilege(Alberich::Privilege::MODIFY, @hardware_profile)
if @hardware_profile.provider_hardware_profile?
Method valid_actions_for_instance_state
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.valid_actions_for_instance_state(state, instance, user=nil)
actions = []
# FIXME: cloud_account won't always be set here, but we're requiring
# front end realm for now.
if cloud_account = instance.provider_account and
- 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 multi_destroy
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def multi_destroy
destroyed = []
errors = []
ids = Array(params[:deployments_selected])
- 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 apply_search_filter
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.apply_search_filter(search)
search, preset_filter_id = search
if search
if preset_filter_id
search_fields = PROFILE_PRESET_FILTERS_OPTIONS.select { |item|
- 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 stoppable_inaccessible_instances
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.stoppable_inaccessible_instances(deployments)
failed_accounts = {}
res = []
deployments.each do |d|
next unless acc = d.provider_account
- 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 set_new_form_variables
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def set_new_form_variables
@base_image ||= Tim::BaseImage.new(params[:base_image])
# FIXME: remove this:
@base_image.template ||= Tim::Template.new
- 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 stoppable_inaccessible_instances
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.stoppable_inaccessible_instances(instances)
failed_accounts = {}
instances.select do |i|
next unless STOPPABLE_INACCESSIBLE_STATES.include?(i.state)
next unless i.provider_account
- 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 apply_search_filter
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.apply_search_filter(search)
search, preset_filter_id = search
if search
if preset_filter_id
search_fields = PROFILE_PRESET_FILTERS_OPTIONS.select { |item|
- 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 run_provider_account_level_checks
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def run_provider_account_level_checks(assembly, provider_account, provider_hwp, provider_image)
unless provider_account.provider.enabled?
@errors << I18n.t('instances.errors.must_be_enabled', :account_name => provider_account.name)
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 destroy
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def destroy
deployable = Deployable.find(params[:id])
@catalog = Catalog.find(params[:catalog_id]) if params[:catalog_id].present?
require_privilege(Alberich::Privilege::MODIFY, deployable)
if deployable.destroy
- 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 show
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def show
@hardware_profile = HardwareProfile.find(Array(params[:id]).first)
require_privilege(Alberich::Privilege::VIEW, @hardware_profile)
@title = if @hardware_profile.provider_hardware_profile?
_('%s (Provider)') % @hardware_profile.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 show
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def show
@deployable = Deployable.find(params[:id])
@catalog = params[:catalog_id].present? ? Catalog.find(params[:catalog_id]) : @deployable.catalogs.first
require_privilege(Alberich::Privilege::VIEW, @deployable)
save_breadcrumb(polymorphic_path([@catalog, @deployable]), @deployable.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 update
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def update
@deployable = Deployable.find(params[:id])
@catalog = Catalog.find(params[:catalog_id]) if params[:catalog_id].present?
require_privilege(Alberich::Privilege::MODIFY, @deployable)
params[:deployable].delete(:owner_id) if params[:deployable]
- 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 cost_in_time
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def cost_in_time(ref_time, start, stop, instance_hwp=nil)
cost = Cost.for_chargeable_and_time(1, id, ref_time)
return nil if cost.nil?
price = 0.0
- 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
Function render
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
render: function() {
this.$('h1.pools').text(this.model.get('name'));
var $template = this.template();
if($template.length === 0) return;
Method load_pool_family_tabs
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def load_pool_family_tabs
@tabs = [{:name => _('Pools'),:view => 'pools', :id => 'pools', :count => @pool_family.pools.count},
{:name => _('Accounts'), :view => 'provider_accounts', :id => 'provider_accounts', :count => @pool_family.provider_accounts.count},
{:name => _('Images'), :view => 'images', :id => 'images', :count => @all_images.count},
]