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 create
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def create
params[:team_consultation] ||= {}
params[:team_consultation].merge!(:student_id => current_student_id, :requestor_id => current_user.id)
params[:team_consultation][:draft] = true if params[:commit] == "Save as Draft" #the js in the view stopped working?
@team_consultation = TeamConsultation.new(params[:team_consultation])
- 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(o.dateSet != null && o.dateSet.getDate() == dt && o.dateSet.getMonth() == tdm && o.dateSet.getFullYear() == tdy) {
cName.push("date-picker-selected-date");
};
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(showArrow) workArr[c][i].appendChild(span.cloneNode(false));
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
if(o.disableDays[weekDay] || stub + String(dt < 10 ? "0" + dt : dt) in disabledDates) {
cName.push("day-disabled");
} else if(o.highlightDays[weekDay]) {
cName.push("date-picker-highlight");
};
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
while(span.firstChild) span.removeChild(span.firstChild);
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( begin_idx == -1 ) break;
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 (j=0; j<o.length; j++) {
results[results.length] = o[j];
}
Avoid deeply nested control flow statements. Open
if( begin_idx == -1 ) break;
Avoid deeply nested control flow statements. Open
if( e.ctrlKey ) {
d = new Date( o.date );
d.setDate( Math.min(d.getDate(), datePicker.getDaysPerMonth(d.getMonth(),d.getFullYear() - 1)) );
d.setFullYear( d.getFullYear() - 1 );
} else {
Avoid deeply nested control flow statements. Open
if(cd == dt) {
td.setAttribute("id", o.id + "-date-picker-hover");
cName.push("date-picker-hover");
};
Avoid deeply nested control flow statements. Open
if(++celCount == rowArr[c].length) break;
Avoid deeply nested control flow statements. Open
if((th.className.match(/sortable-([a-zA-Z\_]+)/)[1] + "PrepareData") in window) {
txt = window[th.className.match(/sortable-([a-zA-Z\_]+)/)[1] + "PrepareData"](td, txt);
};
Avoid deeply nested control flow statements. Open
else if (isObject(o)) {
for (j in o) {
results[results.length] = o[j];
}
}