vegantech/sims

View on GitHub

Showing 433 of 433 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                for(var i = 0, th; th = ths[i]; i++) {
                        a = th.getElementsByTagName("a");
                        if(a.length) a[0].onkeydown = a[0].onclick = null;
                        th.onclick = th.onselectstart = th = a = null;
                };
Severity: Major
Found in app/assets/javascripts/tablesort.js and 1 other location - About 3 hrs to fix
app/assets/javascripts/tablesort.js on lines 117..121

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 107.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

                        for(var j = 0, th; th = row[j]; j++) {
                                a = th.getElementsByTagName("a");
                                if(a.length) a[0].onkeydown = a[0].onclick = null;
                                th.onclick = th.onselectstart = th = a = null;
                        };
Severity: Major
Found in app/assets/javascripts/tablesort.js and 1 other location - About 3 hrs to fix
app/assets/javascripts/tablesort.js on lines 106..110

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 107.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

            function selectDefaultSuggestion() {
                var slct = this.suggestionList;
                var txt = this.replacementText;
                if( slct.options.length == 0 ) {
                    this.addSuggestion( this.noSuggestionSelection );
            Severity: Major
            Found in public/speller/controlWindow.js and 1 other location - About 3 hrs to fix
            app/assets/javascripts/spellerpages/controlWindow.js on lines 43..52

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 97.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

            function selectDefaultSuggestion() {
                var slct = this.suggestionList;
                var txt = this.replacementText;
                if( slct.options.length == 0 ) {
                    this.addSuggestion( this.noSuggestionSelection );
            Severity: Major
            Found in app/assets/javascripts/spellerpages/controlWindow.js and 1 other location - About 3 hrs to fix
            public/speller/controlWindow.js on lines 43..52

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 97.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            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

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                                            if(inp.className.search(/range-high-today/i) != -1 && inp.className.search(/range-low-today/i) == -1) {
                                                    options.high = datePickerController.dateFormat((new Date().getMonth() + 1) + "/" + new Date().getDate() + "/" + new Date().getFullYear(), true);
                                            } else if(inp.className.search(regExp5) != -1) {
                                                    options.high = datePickerController.dateFormat(inp.className.match(regExp5)[0].replace(/range-high-/, ''), false);
                                                    if(!options.high) {
            Severity: Major
            Found in app/assets/javascripts/datepicker.js and 1 other location - About 3 hrs to fix
            app/assets/javascripts/datepicker.js on lines 1397..1404

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 96.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                                            if(inp.className.search(/range-low-today/i) != -1) {
                                                    options.low = datePickerController.dateFormat((new Date().getMonth() + 1) + "/" + new Date().getDate() + "/" + new Date().getFullYear(), true);
                                            } else if(inp.className.search(regExp4) != -1) {
                                                    options.low = datePickerController.dateFormat(inp.className.match(regExp4)[0].replace(/range-low-/, ''), false);
                                                    if(!options.low) {
            Severity: Major
            Found in app/assets/javascripts/datepicker.js and 1 other location - About 3 hrs to fix
            app/assets/javascripts/datepicker.js on lines 1407..1414

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 96.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            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

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                                              if(o.splitDate) {
                                                      var mmN = document.getElementById(o.id+'-mm');
                                                      var ddN = document.getElementById(o.id+'-dd');
                      
                                                      datePickerController.removeEvent(mmN, "change", o.changeHandler);
                      Severity: Major
                      Found in app/assets/javascripts/datepicker.js and 1 other location - About 2 hrs to fix
                      app/assets/javascripts/datepicker.js on lines 767..772

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 91.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Severity
                      Category
                      Status
                      Source
                      Language