vegantech/sims

View on GitHub

Showing 223 of 433 total issues

Function writeBody has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

function writeBody() {
    var d = window.document;
    var is_html = false;

    d.open();
Severity: Minor
Found in public/speller/wordWindow.js - About 3 hrs 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 group_by_cluster_and_objective has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

  def self.group_by_cluster_and_objective(params ={})
    #This will work better

    #refactor this to use recommended monitors?
    probes = find(:all, :order =>"active desc, custom, position", :include => [{:intervention_definitions=>{:intervention_cluster=>:objective_definition}},:intervention_probe_assignments, :recommended_monitors])
Severity: Minor
Found in app/models/probe_definition.rb - About 3 hrs 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 writeBody has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

function writeBody() {
    var d = window.document;
    var is_html = false;

    d.open();
Severity: Minor
Found in app/assets/javascripts/spellerpages/wordWindow.js - About 3 hrs 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 setPosition has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

Popup.prototype.setPosition = function() {
    if (this.position!=null) {
        var m = this.position.match(/^(\S+)\s+(\S+)/); 
        if (m!=null && m.length==3) {
            var v = m[1];
Severity: Minor
Found in app/assets/javascripts/popup.js - About 3 hrs 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

File spellChecker.js has 329 lines of code (exceeds 250 allowed). Consider refactoring.
Open

////////////////////////////////////////////////////
// spellChecker.js
//
// spellChecker object
//
Severity: Minor
Found in public/speller/spellChecker.js - About 3 hrs to fix

    Class User has 30 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class User < ActiveRecord::Base
      # Include default devise modules. Others available are:
      # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
      devise :database_authenticatable, :omniauthable, :recoverable#, :registerable
    #        :recoverable, :rememberable, :trackable, :validatable
    Severity: Minor
    Found in app/models/user.rb - About 3 hrs to fix

      Function initSort has 90 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              initSort: function(noCallback, ident) {
                      var thNode      = fdTableSort.thNode;
                      var tableElem   = document.getElementById(fdTableSort.tableId);
      
                      if(!(fdTableSort.tableId in fdTableSort.tableCache)) { fdTableSort.prepareTableData(document.getElementById(fdTableSort.tableId)); };
      Severity: Major
      Found in app/assets/javascripts/tablesort.js - About 3 hrs to fix

        Function DOM has 89 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        var DOM = (function() { 
            var dom = {};
            
            // Get a parent tag with a given nodename
            dom.getParentByTagName = function(o,tagNames) {
        Severity: Major
        Found in app/assets/javascripts/popup.js - About 3 hrs to fix

          Function create has 85 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  var create = function(inp) {
                          if(!(typeof document.createElement != "undefined" && typeof document.documentElement != "undefined" && typeof document.documentElement.offsetWidth == "number")) return;
          
                          var inputs  = (inp && inp.tagName) ? [inp] : joinNodeLists(document.getElementsByTagName('input'), document.getElementsByTagName('select'));
                          var regExp1 = /disable-days-([1-7]){1,6}/g;             // the days to disable
          Severity: Major
          Found in app/assets/javascripts/datepicker.js - About 3 hrs to fix

            Class DistrictExport has 28 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class DistrictExport
              attr_reader :dir,:district
            
              TO_EXPORT = [
                :answers,
            Severity: Minor
            Found in lib/district_export.rb - About 3 hrs to fix

              Function onkeydown has 80 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                              onkeydown: function (e) {
                                      o.stopTimer();
                                      if(!o.visible) return false;
              
                                      if(e == null) e = document.parentWindow.event;
              Severity: Major
              Found in app/assets/javascripts/datepicker.js - About 3 hrs to fix

                Function Screen has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                var Screen = (function() {
                    var screen = {};
                
                    // Get a reference to the body
                    // --------------------------------------------------------------------
                Severity: Major
                Found in app/assets/javascripts/popup.js - About 3 hrs to fix

                  Function PopupEvent has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                  Open

                  var PopupEvent = (function(){
                      var ev = {};
                      
                      // Resolve an event using IE's window.event if necessary
                      // --------------------------------------------------------------------
                  Severity: Minor
                  Found in app/assets/javascripts/popup.js - About 3 hrs 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

                  Class Checklist has 26 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  class Checklist < ActiveRecord::Base
                    DISTRICT_PARENT = :checklist_definition
                    has_many :answers, :dependent => :destroy
                    belongs_to :checklist_definition, :include => {:question_definitions => {:element_definitions => :answer_definitions}}
                    belongs_to :student
                  Severity: Minor
                  Found in app/models/checklist.rb - About 3 hrs to fix

                    Function terminateSpell has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function terminateSpell() {
                        // called when we have reached the end of the spell checking.
                        var msg = "Spell check complete:\n\n";
                        var numrepl = this._getTotalReplaced();
                        if( numrepl == 0 ) {
                    Severity: Minor
                    Found in public/speller/spellChecker.js - About 2 hrs 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 terminateSpell has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function terminateSpell() {
                        // called when we have reached the end of the spell checking.
                        var msg = "Spell check complete:\n\n";
                        var numrepl = this._getTotalReplaced();
                        if( numrepl == 0 ) {
                    Severity: Minor
                    Found in app/assets/javascripts/spellerpages/spellChecker.js - About 2 hrs 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 prepareTableData has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            prepareTableData: function(table) {
                                    var data = [];
                    
                                    var start = table.getElementsByTagName('tbody');
                                    start = start.length ? start[0] : table;
                    Severity: Major
                    Found in app/assets/javascripts/tablesort.js - About 2 hrs to fix

                      Class Intervention has 25 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                      class Intervention < ActiveRecord::Base
                        DISTRICT_PARENT = :intervention_definition
                        include LinkAndAttachmentAssets
                        include ActionView::Helpers::TextHelper
                        include Stats::Intervention
                      Severity: Minor
                      Found in app/models/intervention.rb - About 2 hrs to fix

                        Class GroupedProgressEntry has 25 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                        class GroupedProgressEntry
                        #  include ActiveModel::Validations
                          include ActiveModel::Conversion
                          extend ActiveModel::Naming
                          attr_accessor :global_date, :intervention, :probe_definition
                        Severity: Minor
                        Found in app/models/grouped_progress_entry.rb - About 2 hrs to fix

                          Class ApplicationController has 25 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                          class ApplicationController < ActionController::Base
                            helper :all # include all helpers, all the time
                            helper_method :multiple_selected_students?, :selected_student_ids,
                              :current_student_id, :current_student, :current_district, :current_school, :current_user,
                              :index_url_with_page, :readonly?
                          Severity: Minor
                          Found in app/controllers/application_controller.rb - About 2 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language