vegantech/sims

View on GitHub

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
Severity: Minor
Found in app/sweepers/intervention_builder_sweeper.rb - About 55 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_definitions has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def generate_probe_definitions
    if File.exist?("#{path}/probe_definitions_monitors.csv")
      pdf="#{path}/probe_definitions_monitors.csv"
    else
      pdf = "#{path}/probe_definitions.csv"
Severity: Minor
Found in lib/training_district/intervention.rb - About 55 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 show has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

Popup.show = function(divObject, referenceObject, position, options, modal) {
    var popup;
    if (defined(divObject)) { 
        popup = new Popup(divObject);
    }
Severity: Minor
Found in app/assets/javascripts/popup.js - About 45 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

Avoid deeply nested control flow statements.
Open

                        if (i > 0) out += ', ';
Severity: Major
Found in app/assets/javascripts/ie-console.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                                                    if(showArrow) workArr[c][i].appendChild(span.cloneNode(false));
    Severity: Major
    Found in app/assets/javascripts/tablesort.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if (i > 0) out += ', ';
      Severity: Major
      Found in app/assets/javascripts/ie-console.js - About 45 mins to fix

        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; 
                                    }
        Severity: Major
        Found in public/speller/spellChecker.js - About 45 mins to fix

          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; 
                                      }
          Severity: Major
          Found in app/assets/javascripts/spellerpages/spellChecker.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                if( begin_idx == -1 ) break; 
            Severity: Major
            Found in public/speller/wordWindow.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  if( begin_idx == -1 ) break; 
              Severity: Major
              Found in app/assets/javascripts/spellerpages/wordWindow.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                                                if(dt == todayD && tdm == todayM && tdy == todayY) {
                                                                        cName.push("date-picker-today");
                                                                };
                Severity: Major
                Found in app/assets/javascripts/datepicker.js - About 45 mins to fix

                  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 ) {
                  Severity: Minor
                  Found in app/assets/javascripts/spellerpages/wordWindow.js - About 45 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

                  Avoid deeply nested control flow statements.
                  Open

                                  for (j=0; j<o.length; j++) {
                                      results[results.length] = o[j];
                                  }
                  Severity: Major
                  Found in app/assets/javascripts/popup.js - About 45 mins to fix

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

                      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;
                                                                              };
                                                                      };
                      Severity: Major
                      Found in app/assets/javascripts/tablesort.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                                        if(!showOnly) {
                                                                                fdTableSort.initSort(false, true);
                                                                        } else {
                                                                                fdTableSort.addThNode();
                                                                        };
                        Severity: Major
                        Found in app/assets/javascripts/tablesort.js - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                                          if(showArrow) {
                                                                                  span = fdTableSort.thNode.getElementsByTagName('span')[0];
                                                                                  if(span.firstChild) { span.removeChild(span.firstChild); };
                                                                                  span.appendChild(document.createTextNode(len == 1 ? " \u2193" : " \u2191"));
                                                                          };
                          Severity: Major
                          Found in app/assets/javascripts/tablesort.js - About 45 mins to fix

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

                              Avoid deeply nested control flow statements.
                              Open

                                                                              for(var cn = workArr[c][i].childNodes.length; cn--;) {
                                                                                      // Skip image nodes and links created by the filter script.
                                                                                      if(workArr[c][i].childNodes[cn].nodeType == 1 && (workArr[c][i].childNodes[cn].className == "fdFilterTrigger" || /img/i.test(workArr[c][i].childNodes[cn].nodeName))) {
                                                                                              continue;
                                                                                      };
                              Severity: Major
                              Found in app/assets/javascripts/tablesort.js - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                                                if(cd == dt) {
                                                                                        td.setAttribute("id", o.id + "-date-picker-hover");
                                                                                        cName.push("date-picker-hover");
                                                                                };
                                Severity: Major
                                Found in app/assets/javascripts/datepicker.js - About 45 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language