Showing 836 of 1,675 total issues
Avoid deeply nested control flow statements. Open
if wbs_profiles_value.nil?
profiles_wbs_data["profile_id_#{profile.id}"]["#{wbs_activity_elt.name}"] = 0
else
value = number_with_delimiter(wbs_profiles_value.round(estimation_value.pe_attribute.precision.nil? ? user_number_precision : estimation_value.pe_attribute.precision))
profiles_wbs_data["profile_id_#{profile.id}"]["#{wbs_activity_elt.name}"] = value
Avoid deeply nested control flow statements. Open
if wbs_project_elt.is_root? || wbs_project_elt.has_children?
res << "#{text_field_tag "[#{level}][#{est_val_pe_attribute.alias.to_sym}][#{module_project.id.to_s}][#{wbs_project_elt.id.to_s}]",
pbs_last_result[wbs_project_elt.id][:value],
:readonly => true,
:class => "input-small #{level} #{est_val.id} #{wbs_project_elt.id} #{attribute_type}",
Method convert_with_specific_precision
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def convert_with_specific_precision(v, organization, precision)
unless v.class == Hash
value = v.to_f
if value < organization.limit1.to_i
(value / organization.limit1_coef.to_f).round(precision)
- 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 product
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def product(pbs_project_element, is_project_show_view)
pbs_product = String.new
pbs_product << "<li>"
pbs_product << "<div class='block_label #{ pbs_project_element == current_component ? 'selected_pbs' : '' }'>
- 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
Avoid deeply nested control flow statements. Open
unless estimation_value.pe_attribute.alias == "ratio" || estimation_value.pe_attribute.alias == "ratio_name"
wbs_activity_elt_root = module_project.wbs_activity.wbs_activity_elements.first.root
wbs_data_low = data_low.nil? ? nil : data_low
wbs_data_high = data_high.nil? ? nil : data_high
Avoid deeply nested control flow statements. Open
if module_default_view.nil?
mp_view = View.create(name: "#{@module_project} view", description: "", pemodule_id: @module_project.pemodule_id, organization_id: @project.organization_id, is_default_view: true)
mp_view_id = mp_view.id
else
mp_view_id = module_default_view.id
Method wbs_record_statuses_collection
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def wbs_record_statuses_collection
#No authorize required since this method is protected and won't be call from route
if @wbs_activity.new_record?
if is_master_instance?
@wbs_record_status_collection = RecordStatus.where('name = ?', 'Proposed').defined
- 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
Avoid deeply nested control flow statements. Open
unless pf.nil?
new_field = new_organization.fields.where(copy_id: pf.field_id).first
pf.views_widget_id = widget_copy.id
pf.field_id = new_field.nil? ? nil : new_field.id
pf.save
Method redirect_save
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def redirect_save(url, anchor=nil)
begin
if anchor.nil?
(params[:commit] == "#{I18n.t 'save'}" or params[:commit] == 'Save') ? url : session[:return_to]
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
Avoid deeply nested control flow statements. Open
estimation_value_id = new_estimation_value.nil? ? nil : new_estimation_value.id
Avoid deeply nested control flow statements. Open
redirect_to (is_model ? organization_setting_path(@current_organization, anchor: "tabs-estimation-models") : organization_estimations_path(@current_organization))
Avoid deeply nested control flow statements. Open
unless pf.nil?
new_field = new_organization.fields.where(copy_id: pf.field_id).first
pf.views_widget_id = widget_copy.id
pf.field_id = new_field.nil? ? nil : new_field.id
pf.save
Avoid deeply nested control flow statements. Open
unless @project.organization.attribute_organizations.nil?
@project.organization.attribute_organizations.each do |am|
['input', 'output'].each do |in_out|
mpa = EstimationValue.create(:pe_attribute_id => am.pe_attribute.id, :module_project_id => cap_module_project.id, :in_out => in_out,
:is_mandatory => am.is_mandatory, :description => am.pe_attribute.description, :display_order => nil,
Method set_current_project
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def set_current_project
begin
if params[:project_id].present? && !params[:project_id].nil?
session[:project_id] = params[:project_id]
@project = Project.find(params[:project_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
Avoid deeply nested control flow statements. Open
estimation_value_id = new_estimation_value.nil? ? nil : new_estimation_value.id
Avoid deeply nested control flow statements. Open
unless pf.nil?
pf.views_widget_id = new_view_widget.id
pf.save
end
Method add_filter_on_project_version
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add_filter_on_project_version
#No authorize required
selected_filter_version = params[:filter_selected]
#"Display leaves projects only",1], ["Display all versions",2], ["Display root version only",3], ["Most recent version",4]
- 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
Avoid deeply nested control flow statements. Open
elsif !project_organization.nil?
# project's organization is deleted and none one is selected
if @project.organization.nil?
cap_module_project.estimation_values.delete_all
Method update
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def update
authorize! :manage_master_data, :all
set_page_title 'Attributes'
- 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
Avoid deeply nested control flow statements. Open
estimation_value_id = new_estimation_value.nil? ? nil : new_estimation_value.id