Showing 1,675 of 1,675 total issues
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
Identical blocks of code found in 3 locations. Consider refactoring. Open
;(function(h){h.tablesorter=h.tablesorter||{};h.tablesorter.filterFormatter={uiSpinner:function(b,f,g){var a=h.extend({min:0,max:100,step:1,value:1,delayed:!0,addToggle:!0,disabled:!1,exactMatch:!0,compare:""},g);g=h('<input class="filter" type="hidden">').appendTo(b).bind("change.tsfilter",function(){d({value:this.value,delayed:!1})});var e=[],j=b.closest("table")[0].config,d=function(d){var c=!0,f,g=d&&d.value&&h.tablesorter.formatFloat((d.value+"").replace(/[><=]/g,""))||b.find(".spinner").val()|| a.value;a.addToggle&&(c=b.find(".toggle").is(":checked"));f=a.disabled||!c?"disable":"enable";b.find(".filter").val(c?(a.compare?a.compare:a.exactMatch?"=":"")+g:"").trigger("search",d&&"boolean"===typeof d.delayed?d.delayed:a.delayed).end().find(".spinner").spinner(f).val(g);e.length&&(e.find(".spinner").spinner(f).val(g),a.addToggle&&(e.find(".toggle")[0].checked=c))};a.oldcreate=a.create;a.oldspin=a.spin;a.create=function(b,c){d();"function"===typeof a.oldcreate&&a.oldcreate(b,c)};a.spin=function(b, c){d(c);"function"===typeof a.oldspin&&a.oldspin(b,c)};a.addToggle&&h('<div class="button"><input id="uispinnerbutton'+f+'" type="checkbox" class="toggle" /><label for="uispinnerbutton'+f+'"></label></div>').appendTo(b).find(".toggle").bind("change",function(){d()});b.closest("thead").find("th[data-column="+f+"]").addClass("filter-parsed");h('<input class="spinner spinner'+f+'" />').val(a.value).appendTo(b).spinner(a).bind("change keyup",function(){d()});j.$table.bind("stickyHeadersInit",function(){e= j.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(f).empty();a.addToggle&&h('<div class="button"><input id="stickyuispinnerbutton'+f+'" type="checkbox" class="toggle" /><label for="stickyuispinnerbutton'+f+'"></label></div>').appendTo(e).find(".toggle").bind("change",function(){b.find(".toggle")[0].checked=this.checked;d()});h('<input class="spinner spinner'+f+'" />').val(a.value).appendTo(e).spinner(a).bind("change keyup",function(){b.find(".spinner").val(this.value);d()})}); j.$table.bind("filterReset",function(){a.addToggle&&(b.find(".toggle")[0].checked=!1);d()});d();return g},uiSlider:function(b,f,g){var a=h.extend({value:0,min:0,max:100,step:1,range:"min",delayed:!0,valueToHeader:!1,exactMatch:!0,compare:"",allText:"all"},g);g=h('<input class="filter" type="hidden">').appendTo(b).bind("change.tsfilter",function(){d({value:this.value})});var e=[],j=b.closest("table")[0].config,d=function(d){var c="undefined"!==typeof d?h.tablesorter.formatFloat((d.value+"").replace(/[><=]/g, ""))||a.min:a.value,g=a.compare+(a.compare?c:c===a.min?a.allText:c);a.valueToHeader?b.closest("thead").find("th[data-column="+f+"]").find(".curvalue").html(" ("+g+")"):b.find(".ui-slider-handle").addClass("value-popup").attr("data-value",g);b.find(".filter").val(a.compare?a.compare+c:c===a.min?"":(a.exactMatch?"=":"")+c).trigger("search",d&&"boolean"===typeof d.delayed?d.delayed:a.delayed).end().find(".slider").slider("value",c);e.length&&(e.find(".slider").slider("value",c),a.valueToHeader?e.closest("thead").find("th[data-column="+ f+"]").find(".curvalue").html(" ("+g+")"):e.find(".ui-slider-handle").addClass("value-popup").attr("data-value",g))};b.closest("thead").find("th[data-column="+f+"]").addClass("filter-parsed");a.valueToHeader&&b.closest("thead").find("th[data-column="+f+"]").find(".tablesorter-header-inner").append('<span class="curvalue" />');a.oldcreate=a.create;a.oldslide=a.slide;a.create=function(b,c){d();"function"===typeof a.oldcreate&&a.oldcreate(b,c)};a.slide=function(b,c){d(c);"function"===typeof a.oldslide&& a.oldslide(b,c)};h('<div class="slider slider'+f+'"/>').appendTo(b).slider(a);j.$table.bind("filterReset",function(){b.find(".slider").slider("value",a.value);d()});j.$table.bind("stickyHeadersInit",function(){e=j.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(f).empty();h('<div class="slider slider'+f+'"/>').val(a.value).appendTo(e).slider(a).bind("change keyup",function(){b.find(".slider").val(this.value);d()})});return g},uiRange:function(b,f,g){var a=h.extend({values:[0,100], min:0,max:100,range:!0,delayed:!0,valueToHeader:!1},g);g=h('<input class="filter" type="hidden">').appendTo(b).bind("change.tsfilter",function(){var b=this.value.split(" - ");""===this.value&&(b=[a.min,a.max]);b&&b[1]&&d({values:b,delay:!1})});var e=[],j=b.closest("table")[0].config,d=function(d){var c=d&&d.values||a.values,g=c[0]+" - "+c[1],h=c[0]===a.min&&c[1]===a.max?"":g;a.valueToHeader?b.closest("thead").find("th[data-column="+f+"]").find(".currange").html(" ("+g+")"):b.find(".ui-slider-handle").addClass("value-popup").eq(0).attr("data-value", c[0]).end().eq(1).attr("data-value",c[1]);b.find(".filter").val(h).trigger("search",d&&"boolean"===typeof d.delayed?d.delayed:a.delayed).end().find(".range").slider("values",c);e.length&&(e.find(".range").slider("values",c),a.valueToHeader?e.closest("thead").find("th[data-column="+f+"]").find(".currange").html(" ("+g+")"):e.find(".ui-slider-handle").addClass("value-popup").eq(0).attr("data-value",c[0]).end().eq(1).attr("data-value",c[1]))};b.closest("thead").find("th[data-column="+f+"]").addClass("filter-parsed"); a.valueToHeader&&b.closest("thead").find("th[data-column="+f+"]").find(".tablesorter-header-inner").append('<span class="currange"/>');a.oldcreate=a.create;a.oldslide=a.slide;a.create=function(b,c){d();"function"===typeof a.oldcreate&&a.oldcreate(b,c)};a.slide=function(b,c){d(c);"function"===typeof a.oldslide&&a.oldslide(b,c)};h('<div class="range range'+f+'"/>').appendTo(b).slider(a);j.$table.bind("filterReset",function(){b.find(".range").slider("values",a.values);d()});j.$table.bind("stickyHeadersInit", function(){e=j.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(f).empty();h('<div class="range range'+f+'"/>').val(a.value).appendTo(e).slider(a).bind("change keyup",function(){b.find(".range").val(this.value);d()})});return g},uiDateCompare:function(b,f,g){var a=h.extend({defaultDate:"",cellText:"",changeMonth:!0,changeYear:!0,numberOfMonths:1,compare:""},g);g=b.closest("thead").find("th[data-column="+f+"]");var e=h('<input class="dateCompare" type="hidden">').appendTo(b).bind("change.tsfilter", function(){var b=this.value;if(b)a.onClose(b)}),j,d=[],k=b.closest("table")[0].config;g.addClass("filter-parsed");j="<label>"+a.cellText+'</label><input type="text" class="date date'+f+'" placeholder="'+(g.data("placeholder")||g.attr("data-placeholder")||"")+'" />';h(j).appendTo(b);a.oldonClose=a.onClose;a.onClose=function(c,e){var f=(new Date(c+(a.compare.match("<")?" 23:59:59":""))).getTime()||"";b.find(".dateCompare").val(a.compare+f).trigger("search").end().find(".date").datepicker("setDate", c);d.length&&d.find(".date").datepicker("setDate",c);"function"===typeof a.oldonClose&&a.oldonClose(c,e)};b.find(".date").datepicker(a);a.filterDate&&b.find(".date").datepicker("setDate",a.filterDate);k.$table.bind("filterReset",function(){b.find(".date").val("").datepicker("option","currentText","");d.length&&d.find(".date").val("").datepicker("option","currentText","")});k.$table.bind("stickyHeadersInit",function(){d=k.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(f).empty(); d.append(j).find(".date").datepicker(a)});return e.val(a.defaultDate?a.defaultDate:"")},uiDatepicker:function(b,f,g){var a=h.extend({from:"",to:"",textFrom:"from",textTo:"to",changeMonth:!0,changeYear:!0,numberOfMonths:1},g),e,j,d=[];g=h('<input class="dateRange" type="hidden">').appendTo(b).bind("change.tsfilter",function(){var c=this.value;if(c.match(" - "))c=c.split(" - "),b.find(".dateTo").val(c[1]),j(c[0]);else if(c.match(">="))j(c.replace(">=",""));else if(c.match("<="))a.onClose(c.replace("<=", ""))});var k=b.closest("table")[0].config;b.closest("thead").find("th[data-column="+f+"]").addClass("filter-parsed");e="<label>"+a.textFrom+'</label><input type="text" class="dateFrom" /><label>'+a.textTo+'</label><input type="text" class="dateTo" />';h(e).appendTo(b);a.oldonClose=a.onClose;a.defaultDate=a.from||a.defaultDate;j=a.onClose=function(c,e){var f=(new Date(c)).getTime()||"",g=(new Date(b.find(".dateTo").val()+" 23:59:59")).getTime()||"";b.find(".dateTo").datepicker("option","minDate",c).end().find(".dateFrom").val(c).end().find(".dateRange").val(f? g?f+" - "+g:">="+f:g?"<="+g:"").trigger("search");d.length&&d.find(".dateTo").datepicker("option","minDate",c).end().find(".dateFrom").val(c);"function"===typeof a.oldonClose&&a.oldonClose(c,e)};b.find(".dateFrom").datepicker(a);a.defaultDate=a.to||"+7d";a.onClose=function(c,e){var f=(new Date(b.find(".dateFrom").val())).getTime()||"",g=(new Date(c+" 23:59:59")).getTime()||"";b.find(".dateFrom").datepicker("option","maxDate",c).end().find(".dateTo").val(c).end().find(".dateRange").val(f?g?f+" - "+ g:">="+f:g?"<="+g:"").trigger("search");d.length&&d.find(".dateFrom").datepicker("option","maxDate",c).end().find(".dateTo").val(c);"function"===typeof a.oldonClose&&a.oldonClose(c,e)};b.find(".dateTo").datepicker(a);k.$table.bind("stickyHeadersInit",function(){d=k.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(f).empty();d.append(e).find(".dateTo").datepicker(a);a.defaultDate=a.from||a.defaultDate||new Date;a.onClose=j;d.find(".dateFrom").datepicker(a)});b.closest("table").bind("filterReset", function(){b.find(".dateFrom, .dateTo").val("");d.length&&d.find(".dateFrom, .dateTo").val("")});e=a.from?a.to?a.from+" - "+a.to:">="+a.from:a.to?"<="+a.to:"";return g.val(e)},html5Number:function(b,f,g){var a,e=h.extend({value:0,min:0,max:100,step:1,delayed:!0,disabled:!1,addToggle:!0,exactMatch:!0,compare:"",skipTest:!1},g);g=h('<input type="number" style="visibility:hidden;" value="test">').appendTo(b);var j=e.skipTest||"number"===g.attr("type")&&"test"!==g.val(),d=[],k=b.closest("table")[0].config, c=function(a,c){var f=e.addToggle?b.find(".toggle").is(":checked"):!0;b.find("input[type=hidden]").val(!e.addToggle||f?(e.compare?e.compare:e.exactMatch?"=":"")+a:"").trigger("search",c?c:e.delayed).end().find(".number").val(a);b.find(".number").length&&(b.find(".number")[0].disabled=e.disabled||!f);d.length&&(d.find(".number").val(a)[0].disabled=e.disabled||!f,e.addToggle&&(d.find(".toggle")[0].checked=f))};g.remove();j&&(a=e.addToggle?'<div class="button"><input id="html5button'+f+'" type="checkbox" class="toggle" /><label for="html5button'+ f+'"></label></div>':"",a+='<input class="number" type="number" min="'+e.min+'" max="'+e.max+'" value="'+e.value+'" step="'+e.step+'" />',b.html(a+'<input type="hidden" />').find(".toggle, .number").bind("change",function(){c(b.find(".number").val())}).closest("thead").find("th[data-column="+f+"]").addClass("filter-parsed").closest("table").bind("filterReset",function(){e.addToggle&&(b.find(".toggle")[0].checked=!1,d.length&&(d.find(".toggle")[0].checked=!1));c(b.find(".number").val())}),b.find("input[type=hidden]").bind("change.tsfilter", function(){c(this.value)}),k.$table.bind("stickyHeadersInit",function(){d=k.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(f).empty();d.html(a).find(".toggle, .number").bind("change",function(){c(d.find(".number").val())});c(b.find(".number").val())}),c(b.find(".number").val()));return j?b.find('input[type="hidden"]'):h('<input type="search">')},html5Range:function(b,f,g){var a=h.extend({value:0,min:0,max:100,step:1,delayed:!0,valueToHeader:!0,exactMatch:!0,compare:"",allText:"all", skipTest:!1},g);g=h('<input type="range" style="visibility:hidden;" value="test">').appendTo(b);var e=a.skipTest||"range"===g.attr("type")&&"test"!==g.val(),j=[],d=b.closest("table")[0].config,k=function(c,d){c=(c+"").replace(/[<>=]/g,"")||a.min;var e=" ("+(a.compare?a.compare+c:c==a.min?a.allText:c)+")";b.find("input[type=hidden]").val(a.compare?a.compare+c:c==a.min?"":(a.exactMatch?"=":"")+c).trigger("search",d?d:a.delayed).end().find(".range").val(c);b.closest("thead").find("th[data-column="+f+ "]").find(".curvalue").html(e);j.length&&(j.find(".range").val(c),j.closest("thead").find("th[data-column="+f+"]").find(".curvalue").html(e))};g.remove();e&&(b.html('<input type="hidden"><input class="range" type="range" min="'+a.min+'" max="'+a.max+'" value="'+a.value+'" />').closest("thead").find("th[data-column="+f+"]").addClass("filter-parsed").find(".tablesorter-header-inner").append('<span class="curvalue" />'),b.find(".range").bind("change",function(){k(this.value)}),b.find("input[type=hidden]").bind("change.tsfilter", function(){var b=this.value;b!==this.lastValue&&(this.value=this.lastValue=a.compare?a.compare+b:b==a.min?"":(a.exactMatch?"=":"")+b,k(b))}),d.$table.bind("stickyHeadersInit",function(){j=d.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(f).empty();j.html('<input class="range" type="range" min="'+a.min+'" max="'+a.max+'" value="'+a.value+'" />').find(".range").bind("change",function(){k(j.find(".range").val())});k(b.find(".range").val())}),b.closest("table").bind("filterReset", function(){k(a.value)}),k(b.find(".range").val()));return e?b.find('input[type="hidden"]'):h('<input type="search">')},html5Color:function(b,f,g){var a,e=h.extend({value:"#000000",disabled:!1,addToggle:!0,exactMatch:!0,valueToHeader:!1,skipTest:!1},g);g=h('<input type="color" style="visibility:hidden;" value="test">').appendTo(b);var j=e.skipTest||"color"===g.attr("type")&&"test"!==g.val(),d=[],k=b.closest("table")[0].config,c=function(a){a=a||e.value;var c=!0,g=" ("+a+")";e.addToggle&&(c=b.find(".toggle").is(":checked")); b.find(".colorpicker").length&&(b.find(".colorpicker").val(a)[0].disabled=e.disabled||!c);b.find("input[type=hidden]").val(c?a+(e.exactMatch?"=":""):"").trigger("search");e.valueToHeader?b.closest("thead").find("th[data-column="+f+"]").find(".curcolor").html(g):b.find(".currentColor").html(g);d.length&&(d.find(".colorpicker").val(a)[0].disabled=e.disabled||!c,e.addToggle&&(d.find(".toggle")[0].checked=c),e.valueToHeader?d.closest("thead").find("th[data-column="+f+"]").find(".curcolor").html(g):d.find(".currentColor").html(g))}; g.remove();j&&(a='<div class="color-controls-wrapper">',a+=e.addToggle?'<div class="button"><input id="colorbutton'+f+'" type="checkbox" class="toggle" /><label for="colorbutton'+f+'"></label></div>':"",a+='<input type="hidden"><input class="colorpicker" type="color" />',a+=(e.valueToHeader?"":'<span class="currentColor">(#000000)</span>')+"</div>",b.html(a),e.valueToHeader&&b.closest("thead").find("th[data-column="+f+"]").find(".tablesorter-header-inner").append('<span class="curcolor" />'),b.find(".toggle, .colorpicker").bind("change", function(){c(b.find(".colorpicker").val())}),b.find("input[type=hidden]").bind("change.tsfilter",function(){c(this.value)}),b.closest("table").bind("filterReset",function(){b.find(".toggle")[0].checked=!1;c(b.find(".colorpicker").val())}),k.$table.bind("stickyHeadersInit",function(){d=k.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(f);d.html(a).find(".toggle, .colorpicker").bind("change",function(){c(d.find(".colorpicker").val())});c(d.find(".colorpicker").val())}),c(e.value)); return j?b.find('input[type="hidden"]'):h('<input type="search">')}}})(jQuery);
- 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 50.
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
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
Similar blocks of code found in 3 locations. Consider refactoring. Open
jsPlumbUtil.addWithFunction(connectionsToPaint, endpointConnections[i][0], function(c) { return c.id == endpointConnections[i][0].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 50.
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
jsPlumbUtil.addWithFunction(connsToPaint, listToRemoveFrom[i][1], function(c) { return c.id == listToRemoveFrom[i][1].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 50.
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
pieRadius = Min([msr.availableHeight / 2, msr.availableWidth / 2]) - config.inGraphDataFontSize - config.inGraphDataPaddingRadius -5;
- 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 50.
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
yStart[j] = animPc * calculateOffset(config, data.datasets[i].data[j], calculatedScale, scaleHop) - (config.barStrokeWidth / 2)
- 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 50.
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
jsPlumbUtil.addWithFunction(connsToPaint, listToAddTo[i][1], function(c) { return c.id == listToAddTo[i][1].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 50.
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