Showing 223 of 433 total issues
Method intervention_probe_assignment
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def intervention_probe_assignment(probe_definition_id = nil)
if probe_definition_id
intervention_probe_assignments.find_or_initialize_by_probe_definition_id(probe_definition_id)
else
p=@ipa || intervention_probe_assignments.active.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 mark_promoted_if_needed
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def mark_promoted_if_needed
if draft?
self.promoted=false
return true
elsif errors.empty? and recommendation and should_promote?
- 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 _getFormInputs
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function _getFormInputs( inputPattern ) {
var inputs = new Array();
for( var i = 0; i < document.forms.length; i++ ) {
for( var j = 0; j < document.forms[i].elements.length; j++ ) {
if( document.forms[i].elements[j].type.match( inputPattern )) {
- 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 answers=
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def answers=(hsh={})
hsh.each do |h|
h=h.last if h.is_a?Array and h.size==2
h=h.symbolize_keys
if h[:recommendation_answer_definition_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
Function replaceWord
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function replaceWord() {
var wi = this.currentWordIndex;
var ti = this.currentTextIndex;
if( !this.wordWin ) {
alert( 'Error: Word frame not available.' );
- 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 goal_in_range
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def goal_in_range
if goal.present? and self.probe_definition.present?
if probe_definition.minimum_score.present? and goal < probe_definition.minimum_score
errors.add(:goal, "below minimum") and return false
end
- 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 replaceWord
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function replaceWord() {
var wi = this.currentWordIndex;
var ti = this.currentTextIndex;
if( !this.wordWin ) {
alert( 'Error: Word frame not available.' );
- 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 setDefaultValues
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function setDefaultValues(o,values) {
if (!defined(o) || o==null) {
o = {};
}
if (!defined(values) || values==null) {
- 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 Popup
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
var Popup = function(div, options) {
this.div = defined(div)?div:null;
this.index = Popup.maxIndex++;
this.ref = "Popup.objects["+this.index+"]";
Popup.objects[this.index] = this;
- 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 createPromptAndInput
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
createPromptAndInput: function() {
var container = document.createElement("div");
container.innerHTML = "<table style=\"width: 100%\" cellspacing=\"0\" cellpadding=\"0\"><tr>" +
"<td width=\"25\" style=\"padding-top: 10px;\">>>></td>" +
"<td><input type=\"text\" /></td>" +
- 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 _getTotalReplaced
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function _getTotalReplaced() {
var i_replaced = 0;
for( var i = 0; i < this.wordFlags.length; i++ ) {
for( var j = 0; j < this.wordFlags[i].length; j++ ) {
if(( this.wordFlags[i][j] == this.replWordFlag )
- 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 flags
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.flags
pids = `ps wx |grep -v grep |grep 'runner' |grep 'PrimeCache'| grep -v 'nice' |cut -f 1 -d' '`
if pids.split("\n").size > 1
puts "Script already running"
exit 0
- 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_students
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.generate_students(district,school,group)
1.upto(30) do |i|
s=FactoryGirl.create(:student, :district => district, :birthdate=>10.years.ago, :first_name => first_names[i-1+ 50*(i %2)].strip, :last_name => "#{i.to_s.rjust(2,'0')}-#{last_names[i-1].capitalize.strip}",
:number => (i-1).to_s)
s.enrollments.create!(:school => school, :grade => 5)
- 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 authorized_groups_for_school
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def authorized_groups_for_school(school,grade=nil)
if all_students_in_school?(school)
if grade
school.groups.by_grade(grade)
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
Method generate_probe_definition_benchmarks
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def generate_probe_definition_benchmarks
CSV.table("#{path}/probe_definition_benchmarks.csv").each do |ck|
next unless ckhash = prephash(ck)
ckhash[:probe_definition_id]= probe_hash[ck[:probe_definition_id]]
newcd= ProbeDefinitionBenchmark.new(ckhash.except(:deleted_at,:copied_at,:copied_from))
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
def update
@checklist=current_student.checklists.find(params[:id])
@checklist.teacher = current_user
if @checklist.update_attributes(params.slice("commit","save_draft","element_definition"))
flash[:notice] = "Checklist has been updated"
- 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 ignore_flags
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def ignore_flags(student, changeable = false)
unless changeable || student.ignore_flags.blank?
popup = "Ignore Flags : #{flag_summary(student.ignore_flags)}"
image_with_popup("I.gif", popup)
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
Method restrict_to_user
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def restrict_to_user
unless @user.blank? || @user.all_students?
grades = @school.special_user_groups.where(:user_id => @user).uniq.pluck(:grade)
unless grades.include? nil #special user group with nil grade = all students in school
explicit_group_assignment_sql = @user.groups.where(:school_id => @school).joins(:students).select("students.id").reorder('').to_sql
- 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 link_to_with_icon
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def link_to_with_icon(name, url, suffix="")
return "" if name.blank?
ext = name.split(".").last.split("?").first
file = name.split("." + ext).first.to_s.gsub(/_/," ") + suffix
icon= ext.blank? ? "icon_htm.gif" : "icon_#{ext.downcase}.gif"
- 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 datepicker_selector
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def datepicker_selector(options, html_options)
datetime = value(object) || default_datetime(options)
options = options.dup
options[:field_name] = @method_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"