Showing 248 of 368 total issues
Method system_require
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def self.system_require(gemfile,*groups)
BundlerExt.parse_from_gemfile(gemfile,*groups).each do |dep|
#This part ripped wholesale from lib/bundler/runtime.rb (github/master)
begin
require dep
- 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_back
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def self.transform_back
unless Credential.all.empty?
Credential.all.each do |credential|
if credential.credential_definition.name == 'username'
credential.provider_account.update_attribute(:username, credential.value)
- 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 load_users
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def load_users
@users = User.includes(:quota).apply_filters(:preset_filter_id => params[:users_preset_filter], :search_filter => params[:users_search])
sort_order = params[:sort_by].nil? ? "username" : params[:sort_by]
# TODO: (lmartinc) Optimize this sort! hell!
if sort_order == "percentage_quota_used"
- 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 get_image_details
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_image_details
deployable_xml = DeployableXML.new(xml)
uuids = deployable_xml.image_uuids
images = []
missing_images = []
Method show
has 47 lines of code (exceeds 25 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)
Method create
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
@provider = Provider.find(params[:provider_id] || params[:provider_account][:provider_id])
require_privilege(Alberich::Privilege::CREATE, ProviderAccount, @provider)
credentials_hash = credentials_hash_prepare
Method edit_xml
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def edit_xml
@base_image = Tim::BaseImage.new(params[:base_image])
if params[:template_source]
@base_image.template = set_template(params[:template_source],
@base_image.pool_family_id)
- 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 total_state_time
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def total_state_time(state)
if !STATES.include?(state)
return _('Error, could not calculate state time: invalid state')
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 show
has 42 lines of code (exceeds 25 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
Method destroy
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def destroy
destroyed = []
failed = []
permission_failed = []
error_messages = []
Method create
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
@deployment = Deployment.new(params[:deployment])
@pool = @deployment.pool
require_privilege(Alberich::Privilege::CREATE, Deployment, @pool)
Method load_options
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def load_options
if @view == "pretty"
@source_type_options = [[_('Deployment'), "Deployment"],
[_('Instance'), "Instance"]]
@group_options = [[_('All'), ""],
Method build_assembly_match
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build_assembly_match
@assembly_matches = []
assembly_level_warnings = []
@errors = []
Method credentials_hash=
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def credentials_hash=(hash={})
if provider
cred_defs = provider.provider_type.credential_definitions
hash.each do |k,v|
cred_def = cred_defs.detect {|d| d.name == k.to_s}
- 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 image_for_mustache
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def image_for_mustache(image)
last_rebuild = I18n.l(Time.at(image.last_built_image_version.created_at.to_f)) rescue ''
os = image.template ? image.template.os : nil
result = {
- 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 13 (exceeds 5 allowed). Consider refactoring. Open
def multi_destroy
destroyed = []
failed = []
permission_failed = []
error_messages = []
- 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 13 (exceeds 5 allowed). Consider refactoring. Open
def show
@user = params[:id] ? User.find(params[:id]) : current_user
require_privilege(Alberich::Privilege::VIEW, User) unless current_user == @user
@title = @user.name.present? ? @user.name : @user.username
@quota_resources = @user.quota.quota_resources
- 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 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
render: function() {
$template = $('#instanceCardTemplate');
if($template.length === 0) return;
var $instances = this.$('ul.instances-array');
Method update
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update
@provider = Provider.find(params[:id])
require_privilege(Alberich::Privilege::MODIFY, @provider)
@provider.assign_attributes(params[:provider])
Method multi_stop
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def multi_stop
notices = []
errors = []
@deployments_to_stop.each do |deployment|