Showing 223 of 433 total issues
Method expire_cache_for
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def expire_cache_for(obj)
if obj.respond_to?(:objective_definitions)
return nil if obj.district.blank?
obj.objective_definitions.each{|o| expire_cache_for_objective_definition(o)}
obj.district.touch
- 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 generate_probe_definitions
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def generate_probe_definitions
if File.exist?("#{path}/probe_definitions_monitors.csv")
pdf="#{path}/probe_definitions_monitors.csv"
else
pdf = "#{path}/probe_definitions.csv"
- 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 show
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Popup.show = function(divObject, referenceObject, position, options, modal) {
var popup;
if (defined(divObject)) {
popup = new Popup(divObject);
}
- 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 (i > 0) out += ', ';
Avoid deeply nested control flow statements. Open
if(showArrow) workArr[c][i].appendChild(span.cloneNode(false));
Avoid deeply nested control flow statements. Open
if (i > 0) out += ', ';
Avoid deeply nested control flow statements. Open
if(( i == text_idx && j >= idx ) || i > text_idx ) {
var origSpell = this.wordWin.originalSpellings[i][j];
if( origSpell == preReplSpell ) {
this.wordFlags[i][j] = undefined;
}
Avoid deeply nested control flow statements. Open
if(( i == text_idx && j >= idx ) || i > text_idx ) {
var origSpell = this.wordWin.originalSpellings[i][j];
if( origSpell == preReplSpell ) {
this.wordFlags[i][j] = undefined;
}
Avoid deeply nested control flow statements. Open
if( begin_idx == -1 ) break;
Avoid deeply nested control flow statements. Open
if( begin_idx == -1 ) break;
Avoid deeply nested control flow statements. Open
if(dt == todayD && tdm == todayM && tdy == todayY) {
cName.push("date-picker-today");
};
Function totalPreviousWords
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function totalPreviousWords( textIndex, wordIndex ) {
var total_words = 0;
for( var i = 0; i <= textIndex; i++ ) {
for( var j = 0; j < this.totalWords( i ); j++ ) {
if( i == textIndex && j == wordIndex ) {
- 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
for (j=0; j<o.length; j++) {
results[results.length] = o[j];
}
Avoid deeply nested control flow statements. Open
if(( i == text_idx && j >= idx ) || i > text_idx ) {
var origSpell = this.wordWin.originalSpellings[i][j];
if( origSpell == preReplSpell ) {
this._setWordText ( i, j, origSpell, undefined );
}
Avoid deeply nested control flow statements. Open
for(var t = 0;((t < colspan)&&((i+t) < rowLength));t++){
for(var n = 0;((n < rowspan)&&((c+n) < workArr.length));n++) {
workArr[(c+n)][(i+t)] = cel;
};
};
Avoid deeply nested control flow statements. Open
if(!showOnly) {
fdTableSort.initSort(false, true);
} else {
fdTableSort.addThNode();
};
Avoid deeply nested control flow statements. Open
if(showArrow) {
span = fdTableSort.thNode.getElementsByTagName('span')[0];
if(span.firstChild) { span.removeChild(span.firstChild); };
span.appendChild(document.createTextNode(len == 1 ? " \u2193" : " \u2191"));
};
Avoid deeply nested control flow statements. Open
if(( i == text_idx && j >= idx ) || i > text_idx ) {
var origSpell = this.wordWin.originalSpellings[i][j];
if( origSpell == preReplSpell ) {
this._setWordText ( i, j, origSpell, undefined );
}
Avoid deeply nested control flow statements. Open
for(var cn = workArr[c][i].childNodes.length; cn--;) {
// Skip image nodes and links created by the filter script.
if(workArr[c][i].childNodes[cn].nodeType == 1 && (workArr[c][i].childNodes[cn].className == "fdFilterTrigger" || /img/i.test(workArr[c][i].childNodes[cn].nodeName))) {
continue;
};
Avoid deeply nested control flow statements. Open
if(cd == dt) {
td.setAttribute("id", o.id + "-date-picker-hover");
cName.push("date-picker-hover");
};