vegantech/sims

View on GitHub

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
Severity: Minor
Found in app/models/intervention.rb - About 25 mins to fix

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?
Severity: Minor
Found in app/models/recommendation.rb - About 25 mins to fix

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 )) {
Severity: Minor
Found in app/assets/javascripts/spellerpages/spellChecker.js - About 25 mins to fix

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]
Severity: Minor
Found in app/models/recommendation.rb - About 25 mins to fix

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.' );
Severity: Minor
Found in app/assets/javascripts/spellerpages/spellChecker.js - About 25 mins to fix

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
Severity: Minor
Found in app/models/intervention_probe_assignment.rb - About 25 mins to fix

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.' );
Severity: Minor
Found in public/speller/spellChecker.js - About 25 mins to fix

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) {
Severity: Minor
Found in app/assets/javascripts/popup.js - About 25 mins to fix

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;
Severity: Minor
Found in app/assets/javascripts/popup.js - About 25 mins to fix

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;\">&gt;&gt;&gt;</td>" +
            "<td><input type=\"text\" /></td>" +
Severity: Minor
Found in app/assets/javascripts/ie-console.js - About 25 mins to fix

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 )
Severity: Minor
Found in app/assets/javascripts/spellerpages/spellChecker.js - About 25 mins to fix

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
Severity: Minor
Found in lib/prime_cache.rb - About 25 mins to fix

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)
Severity: Minor
Found in lib/training_district/student.rb - About 25 mins to fix

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
Severity: Minor
Found in app/models/user.rb - About 25 mins to fix

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))
Severity: Minor
Found in lib/training_district/intervention.rb - About 25 mins to fix

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"
Severity: Minor
Found in app/controllers/checklists_controller.rb - About 25 mins to fix

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
Severity: Minor
Found in app/helpers/flags_helper.rb - About 25 mins to fix

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
Severity: Minor
Found in app/models/student_search.rb - About 25 mins to fix

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"
Severity: Minor
Found in app/helpers/application_helper.rb - About 25 mins to fix

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
Severity: Minor
Found in lib/unobtrusive_date_picker/unobtrusive_date_picker.rb - About 25 mins to fix

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

Severity
Category
Status
Source
Language