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 create has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def create
    params[:team_consultation] ||= {}
    params[:team_consultation].merge!(:student_id => current_student_id, :requestor_id => current_user.id)
    params[:team_consultation][:draft] = true if params[:commit] == "Save as Draft"   #the js in the view stopped working?
    @team_consultation = TeamConsultation.new(params[:team_consultation])
Severity: Minor
Found in app/controllers/team_consultations_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

Avoid deeply nested control flow statements.
Open

                                                if(o.dateSet != null && o.dateSet.getDate() == dt && o.dateSet.getMonth() == tdm && o.dateSet.getFullYear() == tdy) {
                                                        cName.push("date-picker-selected-date");
                                                };
Severity: Major
Found in app/assets/javascripts/datepicker.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(showArrow) workArr[c][i].appendChild(span.cloneNode(false));
      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

                                                        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

          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

                                                          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 (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( 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(( 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 (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( 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( 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(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

                                                                            if(++celCount == rowArr[c].length) break;
                            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

                                            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
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language