Showing 223 of 433 total issues
Avoid deeply nested control flow statements. Open
else if (isObject(o)) {
for (j in o) {
results[results.length] = o[j];
}
}
Avoid deeply nested control flow statements. Open
if(i in columnNumSortObj) {
columnNumSortObj[i]["thNode"] = workArr[c][i];
columnNumSortObj["active"] = true;
};
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
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");
};
Avoid deeply nested control flow statements. Open
if(++celCount == rowArr[c].length) break;
Avoid deeply nested control flow statements. Open
} else if(txt != "") {
fdTableSort.removeClass(th, "sortable");
if(fdTableSort.dateFormat(txt) != 0) {
fdTableSort.addClass(th, "sortable-date");
txt = fdTableSort.dateFormat(txt);
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 {
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((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
while(span.firstChild) span.removeChild(span.firstChild);
Method find_intervention
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def find_intervention
if current_student.blank?
# alternate entry point
intervention = Intervention.find(params[:id])
if intervention && intervention.student && intervention.student.belongs_to_user?(current_user)
- 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 update
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def update
@team_consultation = TeamConsultation.find(params[:id])
params[:team_consultation][:draft] = false if params[:commit] == "Save" #the js in the view does not work in ff
respond_to do |format|
- 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 input_id_from_type
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def input_id_from_type(type, html_options_id = nil)
if html_options_id.blank?
prefix = @options[:prefix] || ActionView::Helpers::DateTimeSelector::DEFAULT_PREFIX
prefix += "_#{@options[:index]}" if @options.has_key?(:index)
prefix += "_#{@options[:field_name]}" if @options.has_key?(:field_name)
- 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_intervention_definitions
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def generate_intervention_definitions(clusterhash)
CSV.table("#{path}/intervention_definitions.csv").each do |ck|
next unless ckhash = prephash(ck)
ckhash[:intervention_cluster_id]= clusterhash[ck[:intervention_cluster_id]]
unless ckhash[:disabled] or ckhash[:custom]
- 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 new
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def new
#Users who are signed in, but go directly to the login page
#are prompted to log in, but stay as the previous user
sign_out && reset_session if user_signed_in?
#fix for above
- 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 change_password
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def change_password
@user = current_user
if request.put?
if params['user'] && params['user']['password'].present?
- 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 flagged
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def flagged
# only include enrollments for students who have at least one of the intervention types.
scope =@enrollments.where("exists (select id from flags where flags.student_id = students.id)"
).joins(:student=>:flags)
- 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_other_students
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.generate_other_students(district,school,group)
grades= ['K', '1', '2', '3', '4', '5']
31.upto(60) do |i|
esl=rand(3) == 1
- 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 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Popup.show = function(divObject, referenceObject, position, options, modal) {
Method assign_team
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def assign_team
self.all_student_scheduled_staff = @whom.include?('all_staff_for_student')
self.team_id = nil unless (@whom.include?('predetermined_teams') || @whom.blank?)
if @whom.include?('other') && @user_ids.present?
- 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"