Method display_inputs_with_activities
has a Cognitive Complexity of 113 (exceeds 5 allowed). Consider refactoring. Open
def display_inputs_with_activities(module_project, last_estimation_result=nil)
pbs_project_element = current_component
res = String.new
if module_project.compatible_with(current_component.work_element_type.alias)# || current_component
pemodule = Pemodule.find(module_project.pemodule.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
File projects_helper.rb
has 899 lines of code (exceeds 250 allowed). Consider refactoring. Open
module ProjectsHelper
# This helper method will display Estimation Result according the estimation purpose (PBS and/or Activities)
def display_results
res = String.new
Method display_results_with_activities
has a Cognitive Complexity of 72 (exceeds 5 allowed). Consider refactoring. Open
def display_results_with_activities(module_project)
res = String.new
pbs_project_element = @pbs_project_element || current_component
pe_wbs_activity = module_project.project.pe_wbs_projects.activities_wbs.first
- 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 display_input
has a Cognitive Complexity of 71 (exceeds 5 allowed). Consider refactoring. Open
def display_input
res = String.new
unless @project.nil?
pbs_project_element = current_component
- 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 display_balancing_input
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
def display_balancing_input(module_project, last_estimation_result)
pbs_project_element = current_component
#Get the current balancing attribute
@current_balancing_attribute = current_balancing_attribute
- 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 display_inputs_with_activities
has 113 lines of code (exceeds 25 allowed). Consider refactoring. Open
def display_inputs_with_activities(module_project, last_estimation_result=nil)
pbs_project_element = current_component
res = String.new
if module_project.compatible_with(current_component.work_element_type.alias)# || current_component
pemodule = Pemodule.find(module_project.pemodule.id)
Method display_results_with_activities
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
def display_results_with_activities(module_project)
res = String.new
pbs_project_element = @pbs_project_element || current_component
pe_wbs_activity = module_project.project.pe_wbs_projects.activities_wbs.first
Method display_effort_balancing_input
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def display_effort_balancing_input(module_project, last_estimation_result)
pbs_project_element = current_component
res = String.new
if module_project.compatible_with(current_component.work_element_type.alias) || current_component
pemodule = Pemodule.find(module_project.pemodule.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 display_inputs_without_activities
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def display_inputs_without_activities(module_project)
pbs_project_element = current_component
res = String.new
if module_project.compatible_with(current_component.work_element_type.alias) || current_component
- 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 display_balancing_input
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
def display_balancing_input(module_project, last_estimation_result)
pbs_project_element = current_component
#Get the current balancing attribute
@current_balancing_attribute = current_balancing_attribute
Method display_effort_balancing_input
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
def display_effort_balancing_input(module_project, last_estimation_result)
pbs_project_element = current_component
res = String.new
if module_project.compatible_with(current_component.work_element_type.alias) || current_component
pemodule = Pemodule.find(module_project.pemodule.id)
Method display_effort_balancing_output
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def display_effort_balancing_output(module_project)
pbs_project_element = @pbs_project_element || current_component
res = String.new
if module_project.compatible_with(current_component.work_element_type.alias) || current_component
pemodule = Pemodule.find(module_project.pemodule.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 display_input
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
def display_input
res = String.new
unless @project.nil?
pbs_project_element = current_component
Method can_do_action_on_estimation?
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def can_do_action_on_estimation?(estimation, project_permission_action_alias)
can_do_something = false
# SuperAdmin user or those who has all permissions has all rights
if current_user.super_admin? || can?(:manage, :all)
- 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 display_inputs_without_activities
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
def display_inputs_without_activities(module_project)
pbs_project_element = current_component
res = String.new
if module_project.compatible_with(current_component.work_element_type.alias) || current_component
Method display_text_field_tag
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def display_text_field_tag(level, est_val, module_project, level_estimation_values, pbs_project_element, attribute_type="", read_only_value=false)
est_val_pe_attribute = est_val.pe_attribute
organization = module_project.project.organization
precision = est_val_pe_attribute.precision.nil? ? user_number_precision : est_val_pe_attribute.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 pemodule_input
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def pemodule_input(level, est_val, module_project, level_estimation_values, pbs_project_element, attribute_type="", read_only_value=false)
est_val_pe_attribute = est_val.pe_attribute
if est_val_pe_attribute.attr_type == 'integer' or est_val_pe_attribute.attr_type == 'float'
- 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 display_effort_balancing_output
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def display_effort_balancing_output(module_project)
pbs_project_element = @pbs_project_element || current_component
res = String.new
if module_project.compatible_with(current_component.work_element_type.alias) || current_component
pemodule = Pemodule.find(module_project.pemodule.id)
Method display_balancing_output
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def display_balancing_output(module_project)
#pbs_project_element = @pbs_project_element || @project.root_component
pbs_project_element = current_component
res = String.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 display_results
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def display_results
res = String.new
unless @project.nil?
#pbs_project_element = @pbs_project_element || @project.root_component
pbs_project_element = @pbs_project_element || current_component
- 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 display_value
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def display_value(value, est_val, mp_id)
module_project = ModuleProject.find(mp_id)
est_val_pe_attribute = est_val.pe_attribute
precision = est_val_pe_attribute.precision.nil? ? user_number_precision : est_val_pe_attribute.precision
if est_val_pe_attribute.alias == "retained_size" || est_val_pe_attribute.alias == "theorical_size"
- 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 display_balancing_output
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def display_balancing_output(module_project)
#pbs_project_element = @pbs_project_element || @project.root_component
pbs_project_element = current_component
res = String.new
Method display_text_field_tag
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def display_text_field_tag(level, est_val, module_project, level_estimation_values, pbs_project_element, attribute_type="", read_only_value=false)
est_val_pe_attribute = est_val.pe_attribute
organization = module_project.project.organization
precision = est_val_pe_attribute.precision.nil? ? user_number_precision : est_val_pe_attribute.precision
Method display_results_without_activities
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def display_results_without_activities(module_project)
res = String.new
pbs_project_element = @pbs_project_element || current_component
pemodule = Pemodule.find(module_project.pemodule.id)
Method pemodule_input
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def pemodule_input(level, est_val, module_project, level_estimation_values, pbs_project_element, attribute_type="", read_only_value=false)
est_val_pe_attribute = est_val.pe_attribute
if est_val_pe_attribute.attr_type == 'integer' or est_val_pe_attribute.attr_type == 'float'
Method pemodule_input
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def pemodule_input(level, est_val, module_project, level_estimation_values, pbs_project_element, attribute_type="", read_only_value=false)
Method display_text_field_tag
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def display_text_field_tag(level, est_val, module_project, level_estimation_values, pbs_project_element, attribute_type="", read_only_value=false)
Method convert_label
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def convert_label(v, organization)
unless v.class == Hash
value = v.to_f
if value < organization.limit1.to_i
organization.limit1_unit
- 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
nullity_condition ? nil : level_estimation_values[pbs_project_element.id][wbs_project_elt.id],
Avoid deeply nested control flow statements. Open
nullity_condition ? level_estimation_values["default_#{level}".to_sym] : level_estimation_values[pbs_project_element.id][wbs_project_elt.id],
Method convert
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def convert(v, organization)
unless v.class == Hash
value = v.to_f
if value < organization.limit1.to_i
convert_with_precision(value / organization.limit1_coef.to_f, user_number_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
Avoid deeply nested control flow statements. Open
unless refer_module_project.nil?
# Get the estimation_value corresponding to the linked Effort_breakdown module (if there is one)
last_estimation_results = EstimationValue.where('in_out = ? AND pe_attribute_id = ? AND module_project_id = ?', 'output', refer_attribute.id, refer_module_project.id).first
if last_estimation_results.nil?
Method convert_without_precision
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def convert_without_precision(v, organization)
unless v.class == Hash
value = v.to_f
if value < organization.limit1.to_i
value / organization.limit1_coef.to_f
- 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
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 show_project_history_graph
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def show_project_history_graph(project)
require 'gratr/import'
require 'gratr/dot'
#ObjectSpace.each_object(Module) do |m|
- 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
Identical blocks of code found in 2 locations. Consider refactoring. Open
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}",
"data-est_val_id" => est_val.id, "data-wbs_project_elt_id" => wbs_project_elt.id}"
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 57.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
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}",
"data-est_val_id" => est_val.id, "data-wbs_project_elt_id" => wbs_project_elt.id}"
readonly_option = true
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 57.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
if level_estimation_values.nil? || level_estimation_values[pbs_project_element.id].nil? || level_estimation_values[pbs_project_element.id][wbs_project_elt.id].nil? || level_estimation_values[pbs_project_element.id][wbs_project_elt.id][:value].nil?
res << ' - '
else
res << "#{display_value(level_estimation_values[pbs_project_element.id][wbs_project_elt.id][:value], est_val)}"
end
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 28.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
if level_probable_value.nil? || level_probable_value[pbs_project_element.id].nil? || level_probable_value[pbs_project_element.id][project_wbs_project_elt_root.id].nil? || level_probable_value[pbs_project_element.id][project_wbs_project_elt_root.id][:value].nil?
res << '-'
else
res << "<div align='center'><strong>#{display_value(level_probable_value[pbs_project_element.id][project_wbs_project_elt_root.id][:value], est_val)}</strong></div>"
end
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 28.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
:readonly => readonly_option || read_only_attribute_level,
:class => "input-small #{level} #{est_val.id} #{wbs_project_elt.id} #{attribute_type}",
"data-est_val_id" => est_val.id, "data-wbs_project_elt_id" => wbs_project_elt.id }"
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 26.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
:readonly => readonly_option || read_only_attribute_level,
:class => "input-small #{level} #{est_val.id} #{wbs_project_elt.id} #{attribute_type}",
"data-est_val_id" => est_val.id, "data-wbs_project_elt_id" => wbs_project_elt.id }"
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 26.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
unless level.eql?("probable")
pbs_data_level = est_val.send("string_data_#{level}")
pbs_data_level.nil? ? pbs_level_data_for_consistency[level] = nil : pbs_level_data_for_consistency[level] = pbs_data_level[pbs_project_element.id]
end
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 25.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76