vegantech/sims

View on GitHub

Showing 223 of 433 total issues

Method index has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def index
    #TODO test and refactor
    flash[:notice]=nil

    @without=params[:without]
Severity: Minor
Found in app/controllers/stats_controller.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 == 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

    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

                                                    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((th.className.match(/sortable-([a-zA-Z\_]+)/)[1] + "PrepareData") in window) {
                                                      txt = window[th.className.match(/sortable-([a-zA-Z\_]+)/)[1] + "PrepareData"](td, txt);
                                              };
      Severity: Major
      Found in app/assets/javascripts/tablesort.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                                        while(span.firstChild) span.removeChild(span.firstChild);
        Severity: Major
        Found in app/assets/javascripts/tablesort.js - About 45 mins to fix

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

            Avoid deeply nested control flow statements.
            Open

                                                            if(i in columnNumSortObj) {
                                                                    columnNumSortObj[i]["thNode"] = workArr[c][i];
                                                                    columnNumSortObj["active"] = true;
                                                            };
            Severity: Major
            Found in app/assets/javascripts/tablesort.js - About 45 mins to fix

              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 {
              Severity: Major
              Found in app/assets/javascripts/datepicker.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( 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(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

                      Avoid deeply nested control flow statements.
                      Open

                                  else if (isObject(o)) {
                                      for (j in o) {
                                          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(!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

                                                          } else if(txt != "") {
                                                                  fdTableSort.removeClass(th, "sortable");
                                                                  if(fdTableSort.dateFormat(txt) != 0) {
                                                                          fdTableSort.addClass(th, "sortable-date");
                                                                          txt = fdTableSort.dateFormat(txt);
                          Severity: Major
                          Found in app/assets/javascripts/tablesort.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 public/speller/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 > 0) out += ', ';
                              Severity: Major
                              Found in app/assets/javascripts/ie-console.js - About 45 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language