Showing 248 of 368 total issues
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 update_quota
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update_quota(state_from, state_to, an_instance)
pool = an_instance.pool
pool_family = pool.pool_family
user = an_instance.owner
provider_account = an_instance.provider_account
Method build_assembly_instance
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build_assembly_instance(assembly, permission_session, user)
assembly_hwp = HardwareProfile.find_allowed_frontend_hwp_by_name(permission_session, user, assembly.hwp)
assembly_errors = Validator.errors_for_assembly(assembly, assembly_hwp)
if assembly_errors.any?
Method up
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.up
create_table :hardware_profile_properties do |t|
t.string :name, :null => false
t.string :kind, :null => false
t.string :unit, :null => false
Method update
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update
@provider_account = ProviderAccount.find(params[:id])
require_privilege(Alberich::Privilege::MODIFY, @provider_account.provider)
require_privilege(Alberich::Privilege::MODIFY, @provider_account)
credentials_hash = credentials_hash_prepare
Method up
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.up
add_column :permissions, :entity_id, :integer
add_column :derived_permissions, :entity_id, :integer
Permission.reset_column_information
Method remove_members
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def remove_members
@user_group = UserGroup.find(params[:id])
require_privilege(Alberich::Privilege::MODIFY, User)
unless @user_group.membership_source == UserGroup::MEMBERSHIP_SOURCE_LOCAL
Method multi_destroy
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def multi_destroy
deleted = []
not_deleted = []
not_deleted_perms = []
Method export_logs
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def export_logs
load_events
load_headers
csvm = get_csv_class
Method multi_destroy
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def multi_destroy
destroyed = []
errors = []
ids = Array(params[:deployments_selected])
Method update
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update
transform_quota_param(:pool)
@pool = Pool.find(params[:id])
require_privilege(Alberich::Privilege::MODIFY, @pool)
@catalogs = @pool.catalogs.list_for_user(current_session, current_user,
Method setup_viewstate_routes
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def setup_viewstate_routes(action)
@@viewstate_routes ||= []
self.send(:define_method, "get_viewstate_#{action}") { get_viewstate_body(action) }
self.send(:define_method, "put_viewstate_#{action}") { put_viewstate_body(action) }
self.send(:define_method, "post_viewstate_#{action}") { post_viewstate_body(action) }
Method match_hardware_profile_property
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.match_hardware_profile_property(front_end_property, back_end_property)
# if the front_end_property is nil, we don't care about it, so everything matches:
return true if front_end_property.nil? || front_end_property.value.to_s.empty?
# if the back_end_property is nil, it only matches if front-end is also nil:
return false if back_end_property.nil? || back_end_property.value.to_s.empty?
Method pool_for_mustache
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def pool_for_mustache(pool)
pool_statistics = pool.statistics
user_can_access_pool_family =
check_privilege(Alberich::Privilege::VIEW, pool.pool_family)
Method load_hardware_profiles
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def load_hardware_profiles
sort_order = sort_direction
sort_field = sort_column(HardwareProfile, 'name')
if sort_field == "name"
@hardware_profiles = HardwareProfile.where('provider_id IS NULL', {}).
Method create
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
transform_quota_param(:pool)
@title = _('New Pool')
@pool = Pool.new(params[:pool])
@pool.quota = Quota.new(params[:pool][:quota_attributes])
Method show
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def show
@deployment = Deployment.find(params[:id])
@title = _('%s Deployment') % @deployment.name
require_privilege(Alberich::Privilege::VIEW, @deployment)
init_new_deployment_attrs
- 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 connection_valid?
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def connection_valid?
if status.untested? or (changed? and (changes.keys & @@status_fields).empty?)
error_str = nil
begin
response = test_connection
- 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 authenticate
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.authenticate(username, password, ipaddress)
username = username.strip unless username.nil?
return unless u = User.find_by_username(username)
# FIXME: this is because of tests - encrypted password is submitted,
# don't know how to get unencrypted version (from factorygirl)
- 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_reboot
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def multi_reboot
notices = []
errors = []
Instance.find(params[:instance_selected] || []).each do |instance|
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"